Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.olafpanz.translationtable
Class TranslationEntry

    java.lang.Object
      de.olafpanz.translationtable.TranslationEntry

All Implemented Interfaces:
  java.lang.Comparable<TranslationEntry>

    final class TranslationEntry

extends java.lang.Object
implements java.lang.Comparable<TranslationEntry>

Contains one translation entry.

Author:
  Olaf Panz

Field Summary
`private java.lang.String` | `desc` Description of this entry
`private java.lang.String` | `group` A translation entry might belong to a group.
`private java.lang.String` | `key` Key to this entry
`private java.util.List<java.lang.String>` | `translations` List of translation, is corresponding to locales in TranslationTable.
`private TranslationDataType` | `type` Type of this entry

Constructor Summary
`TranslationEntry(java.lang.String key, java.lang.String group, TranslationDataType type, java.lang.String desc, java.util.List<java.lang.String> translations)` Create a translation entry

Method Summary
`void` | `collectImports(java.util.Set<java.lang.String> imports, int localeIndex, TranslationDocument doc)` Collect all used imports
`int` | `compareTo(TranslationEntry arg0)` Compare with another translation entry by key.
`private java.lang.String` | `convert2Character(java.lang.String str)` Convert a declarative string to code that creates a character.
`private java.lang.String` | `convert2KeyStroke(java.lang.String str)` Convert a descriptive string to a key stroke define.
`static java.lang.String` | `createKey(TranslationDataType type, java.lang.String group, java.lang.String plainKey)` Create a key from type and plan key.
`java.lang.String` | `getDesc()`
`java.lang.String` | `getGroup()`
`java.lang.String` | `getGroupKey()` Return combination of group and key
`java.lang.String` | `getJavaDoc(java.util.List<LocaleDef> locales, java.lang.String indend, TranslationDocument doc)` Create java doc comment of this entry.
`java.lang.String` | `getKey()`
`java.lang.String` | `getPlainKey()` This is the key without type prefix
`private java.lang.String` | `getRawTranslationString(int translationIndex, TranslationDocument doc)` Request the raw translation string for a language at an index position.
`java.util.List<java.lang.String>` | `getTranslations()`
`TranslationDataType` | `getType()`
`java.lang.String` | `getValueAsString(int translationIndex, TranslationDocument doc)` Evaluate the string that should be written to file for a given index.
`java.lang.String` | `toString()` Debug only

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### key

    private final java.lang.String key

  Key to this entry

### type

    private final TranslationDataType type

  Type of this entry

### desc

    private final java.lang.String desc

  Description of this entry

### translations

    private final java.util.List<java.lang.String> translations

  List of translation, is corresponding to locales in TranslationTable.

### group

    private final java.lang.String group

  A translation entry might belong to a group. This might be null.

Constructor Detail

### TranslationEntry

    public TranslationEntry(java.lang.String key,
                            java.lang.String group,
                            TranslationDataType type,
                            java.lang.String desc,
                            java.util.List<java.lang.String> translations)

  Create a translation entry

  Parameters:
    `key` - Key to this entry
    `group` - A translation entry might belong to a group. This might be null.
    `type` - Type of this entry
    `desc` - Desription of this entry
    `translations` - List of translation, is corresponding to locales in TranslationTable.

Method Detail

### createKey

    public static java.lang.String createKey(TranslationDataType type,
                                             java.lang.String group,
                                             java.lang.String plainKey)

  Create a key from type and plan key.

  Parameters:
    `type` - The type
    `plainKey` - The plain key.
    `group` - Group of this translation value.
  Returns:
    The created full key.

### toString

    public java.lang.String toString()

  Debug only

  Overrides:
    `toString` in class `java.lang.Object`
  See Also:
    `Object.toString()`

### compareTo

    public int compareTo(TranslationEntry arg0)

  Compare with another translation entry by key.

  Specified by:
    `compareTo` in interface `java.lang.Comparable<TranslationEntry>`
  Parameters:
    `arg0` - The other entry
  Returns:
    see declaration

### convert2Character

    private final java.lang.String convert2Character(java.lang.String str)

  Convert a declarative string to code that creates a character.

  Parameters:
    `str` - The declarative String
  Returns:
    The code fragment

### convert2KeyStroke

    private final java.lang.String convert2KeyStroke(java.lang.String str)

  Convert a descriptive string to a key stroke define. Format: Allowed is a combination of one key expression and a list of modifiers. All keys defined in KeyEvent are allowed. VK_ can be written, but it is added, if not present. It is also possible to specify a character value by \\uXXXX Allowed modifiers: SHIFT, CTRL, META, ALT. The elements are combined by "+". Examples: "Alt+F4", "E+SHIFT", "A+Shift+Alt", "VK_E","\\u4711+SHIFT"

  Parameters:
    `str` - The descriptive string
  Returns:
    The generated code fragment

### getDesc

    public java.lang.String getDesc()

  Returns:
    Description of this entry

### getJavaDoc

    public java.lang.String getJavaDoc(java.util.List<LocaleDef> locales,
                                       java.lang.String indend,
                                       TranslationDocument doc)

  Create java doc comment of this entry.

  Parameters:
    `locales` - Current locale list, used to create list of translations
    `indend` - Indend, used for new line.
    `doc` - Document is needed to resolve translation string.
  Returns:
    Created string

### getGroup

    public java.lang.String getGroup()

  Returns:
    A translation entry might belong to a group. This might be null.

### getKey

    public java.lang.String getKey()

  Returns:
    The key with type prefix.

### getGroupKey

    public java.lang.String getGroupKey()

  Return combination of group and key

  Returns:
    Is never null

### getPlainKey

    public java.lang.String getPlainKey()

  This is the key without type prefix

  Returns:
    Key to this entry

### getTranslations

    public java.util.List<java.lang.String> getTranslations()

  Returns:
    List of translation, is corresponding to locales in TranslationTable.

### getType

    public TranslationDataType getType()

  Returns:
    Type of this entry

### getRawTranslationString

    private java.lang.String getRawTranslationString(int translationIndex,
                                                     TranslationDocument doc)

  Request the raw translation string for a language at an index position. Default values are resolved here. Note that the document will fix the data model for endless recursions.

  Parameters:
    `translationIndex` - Index of requested translation.
    `doc` - Document is needed for default language resolving.
  Returns:
    Is never null.

### getValueAsString

    public java.lang.String getValueAsString(int translationIndex,
                                             TranslationDocument doc)

  Evaluate the string that should be written to file for a given index.

  Parameters:
    `translationIndex` - The index of the tanslation
    `doc` - Document is needed to resolve derived languages.
  Returns:
    The Source code fragment.

### collectImports

    public void collectImports(java.util.Set<java.lang.String> imports,
                               int localeIndex,
                               TranslationDocument doc)

  Collect all used imports

  Parameters:
    `imports` - Fill this set with results.
    `localeIndex` - Index of locale to collect imports for.
    `doc` - Document is needed to resolve derived languages.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD