Class StringDictionaryData

java.lang.Object
com.e1c.langtool.storage.properties.StringDictionaryData
All Implemented Interfaces:
DictionaryData

public class StringDictionaryData extends Object implements DictionaryData
The dictionary data model of the file with String key and String value. Allows to configure case-sensitive of the key and the value for all entries. This implementation is thread-safe.
  • Field Details

    • keyCaseSensitive

      protected final boolean keyCaseSensitive
    • valueCaseSensitive

      protected final boolean valueCaseSensitive
    • storage

      protected final Map<String,String> storage
    • comments

      protected final Map<String,String> comments
  • Constructor Details

    • StringDictionaryData

      public StringDictionaryData(boolean keyCaseSensitive, boolean valueCaseSensitive, String comment)
      Instantiates a new string dictionary data.
      Parameters:
      keyCaseSensitive - the key case sensitive
      valueCaseSensitive - the value case sensitive
      comment - the comment, can be null.
    • StringDictionaryData

      public StringDictionaryData(boolean keyCaseSensitive, boolean valueCaseSensitive, String comment, Runnable changeNotification)
      Instantiates a new string dictionary data.
      Parameters:
      keyCaseSensitive - the key case sensitive
      valueCaseSensitive - the value case sensitive
      comment - the comment, can be .
      changeNotification - the change notification, can be .
  • Method Details

    • getComment

      public String getComment()
      Description copied from interface: DictionaryData
      Gets the comment.
      Specified by:
      getComment in interface DictionaryData
      Returns:
      the comment, can return null.
    • setComment

      public void setComment(String comment)
      Description copied from interface: DictionaryData
      Sets top data object comment.
      Specified by:
      setComment in interface DictionaryData
      Parameters:
      comment - the new comment, can be null.
    • setTranslation

      public String setTranslation(TranslationKey translationKey, String value, String comment)
      Description copied from interface: DictionaryData
      Sets the translation and comment for the translation key.
      Specified by:
      setTranslation in interface DictionaryData
      Parameters:
      translationKey - the translation key, cannot be null.
      value - the value, can be null.
      comment - the comment, can be null.
      Returns:
      the previous translation, can return null if was no translation before.
    • getTranslation

      public String getTranslation(TranslationKey translationKey)
      Description copied from interface: DictionaryData
      Gets the translation by the translation key.
      Specified by:
      getTranslation in interface DictionaryData
      Parameters:
      translationKey - the translation key, cannot be null.
      Returns:
      the translation, can return null.
    • getComment

      public String getComment(TranslationKey translationKey)
      Description copied from interface: DictionaryData
      Gets the comment for the translation key.
      Specified by:
      getComment in interface DictionaryData
      Parameters:
      translationKey - the translation key, cannot be null.
      Returns:
      the comment, can return null.
    • removeTranslation

      public String removeTranslation(TranslationKey translationKey)
      Description copied from interface: DictionaryData
      Removes the translation by the key.
      Specified by:
      removeTranslation in interface DictionaryData
      Parameters:
      translationKey - the translation key, cannot be null.
      Returns:
      the translation, can return null if was no any translation.
    • hasKeyForValue

      public boolean hasKeyForValue(String value, TranslationKey skipKey)
      Description copied from interface: DictionaryData
      Checks if there is a key for the translation value.
      Specified by:
      hasKeyForValue in interface DictionaryData
      Parameters:
      value - the translation value, cannot be null.
      skipKey - the key which should be ignored if translation value found for this key, may be null if need to check all keys.
      Returns:
      true, if data object has translation value
    • fireChanged

      protected void fireChanged()