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 TranslationDocument

    java.lang.Object
      de.olafpanz.translationtable.TranslationDocument

    final class TranslationDocument

extends java.lang.Object

Contains a loaded translation document.

Author:
  Olaf Panz

Field Summary
`private java.lang.String` | `classComment` Comment for generated class.
`private java.lang.String` | `className` Class base name.
`private java.util.List<LocaleDef>` | `locales` List of supported locales in order or usage in data.
`private java.lang.String` | `name` Base name of table within multi-table file.
`private java.lang.String` | `packageName` Name of package.
`private int[]` | `templateLocales` Default locales of locale, positions correspond to `locales`.
`private java.util.Set<TranslationEntry>` | `translations` All translation entries.

Constructor Summary
`TranslationDocument(java.lang.String className, java.lang.String packageName, java.lang.String classComment, java.lang.String name, java.util.List<LocaleDef> locales)` Create new document

Method Summary
`boolean` | `addTranslation(TranslationEntry entry)` Add a translation key
`java.lang.String` | `getClassComment()`
`java.lang.String` | `getClassName()`
`int` | `getDefaultLocale()` The default locale is the locale that is used if no specific translations exists for a locale
`private static int` | `getIndex(java.util.List<LocaleDef> lst, java.util.Locale loc)` Search for an locale within a list of LocaleDef
`java.util.List<LocaleDef>` | `getLocales()` List of supported locales in order or usage in data.
`java.lang.String` | `getName()`
`java.lang.String` | `getPackageName()`
`int` | `getTemplateLocaleIndex(int localeIndex)` Returns index of template locale
`java.util.Set<TranslationEntry>` | `getTranslations()` All translation entries.
`boolean` | `hasBundle()` Check, if at least one Bundle-Translation exists
`boolean` | `hasRCP()` Check, if at least one RCP-Translation exists

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

Field Detail

### translations

    private final java.util.Set<TranslationEntry> translations

  All translation entries.

### locales

    private final java.util.List<LocaleDef> locales

  List of supported locales in order or usage in data.

### name

    private final java.lang.String name

  Base name of table within multi-table file.

### packageName

    private final java.lang.String packageName

  Name of package.

### className

    private final java.lang.String className

  Class base name.

### classComment

    private final java.lang.String classComment

  Comment for generated class.

### templateLocales

    private final int[] templateLocales

  Default locales of locale, positions correspond to `locales`.

Constructor Detail

### TranslationDocument

    public TranslationDocument(java.lang.String className,
                               java.lang.String packageName,
                               java.lang.String classComment,
                               java.lang.String name,
                               java.util.List<LocaleDef> locales)

  Create new document

  Parameters:
    `className` - Class base name.
    `packageName` - Name of package.
    `classComment` - Comment for generated class.
    `name` - Base name of table within multi-table file.
    `locales` - List of locales in the document

Method Detail

### getIndex

    private static int getIndex(java.util.List<LocaleDef> lst,
                                java.util.Locale loc)

  Search for an locale within a list of LocaleDef

  Parameters:
    `lst` - Null is not allowed.
    `loc` - Null is not allowed.
  Returns:
    Is -1, if locale was not found.

### getTranslations

    public java.util.Set<TranslationEntry> getTranslations()

  All translation entries.

  Returns:
    Set is unmodifiable

### getTemplateLocaleIndex

    public int getTemplateLocaleIndex(int localeIndex)

  Returns index of template locale

  Parameters:
    `localeIndex` - Index of locale for that the default locale is requested
  Returns:
    The index, is -1, if no default locale exists.

### getDefaultLocale

    public int getDefaultLocale()

  The default locale is the locale that is used if no specific translations exists for a locale

  Returns:
    Index of locale

### getLocales

    public java.util.List<LocaleDef> getLocales()

  List of supported locales in order or usage in data.

  Returns:
    List is unmodifiable

### getName

    public java.lang.String getName()

  Returns:
    Base name of table within multi-table file.

### getPackageName

    public java.lang.String getPackageName()

  Returns:
    Name of package.

### getClassName

    public java.lang.String getClassName()

  Returns:
    Comment for generated class.

### getClassComment

    public java.lang.String getClassComment()

  Returns:
    Class base name.

### addTranslation

    public boolean addTranslation(TranslationEntry entry)

  Add a translation key

  Parameters:
    `entry` - null is not allowed.
  Returns:
    true, if entry was added, false, if entry with same key allready exists.

### hasBundle

    public boolean hasBundle()

  Check, if at least one Bundle-Translation exists

  Returns:
    true, if yes

### hasRCP

    public boolean hasRCP()

  Check, if at least one RCP-Translation exists

  Returns:
    true, if yes

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