Class LocalizedFieldHelper

java.lang.Object
ch.tocco.nice2.dbrefactoring.spi.modulesupport.LocalizedFieldHelper

public class LocalizedFieldHelper extends Object
This class is meant to help with localized fields. It builds a bidirectional map of fields <-> locale that can be used to retrieve virtual fields for synthetic ones or to find out the concrete locale of a synthetic localized field.
  • Field Details

  • Constructor Details

    • LocalizedFieldHelper

      public LocalizedFieldHelper(EntityModel entityModel)
  • Method Details

    • getEntityModel

      public EntityModel getEntityModel()
    • getLocale

      public Optional<Locale> getLocale(FieldModel syntheticAndLocalized)
      If the given field is localized and synthetic, it determines which locale it represents.
    • getBaseField

      public Optional<FieldModel> getBaseField(FieldModel syntheticAndLocalized)
      Returns the virtual field model corresponding to the given localized synthetic one.
    • findFieldByTarget

      public Optional<FieldModel> findFieldByTarget(String name)
      Finds the field model by the given target.
    • getFieldTarget

      public String getFieldTarget(String basename, Locale lang)
      Returns the target of the field with the given basename and locale. If there is no field with this locale an exception is thrown.
    • getDefaultLocale

      public static Locale getDefaultLocale(L10N l10n)
    • getAvailableLocales

      public static Set<Locale> getAvailableLocales(L10N l10n)