Class LocalizedFeature

java.lang.Object
de.hybris.platform.classification.features.Feature
de.hybris.platform.classification.features.LocalizedFeature

public class LocalizedFeature extends Feature
Localized feature contains collection of values for each language. Note that all methods for setting, getting and clearing values which do not have Locale parameter will operate on current data locale.
  • Constructor Details

    • LocalizedFeature

      public LocalizedFeature(ClassAttributeAssignmentModel assignment, Map<Locale,List<FeatureValue>> values, Locale currentLocale)
      Instantiates a new localized typed feature.
      Parameters:
      assignment - the assignment
      values - the values
      currentLocale - the current locale
    • LocalizedFeature

      public LocalizedFeature(String code, Map<Locale,List<FeatureValue>> values, Locale currentLocale)
      Instantiates a new localized untyped feature.
      Parameters:
      code - the code
      values - the values
      currentLocale - the current locale
  • Method Details

    • getValuesForAllLocales

      public Map<Locale,List<FeatureValue>> getValuesForAllLocales()
      Gets the whole map of values where key is Locale and value list of feature values.
      Returns:
      the values
    • getValues

      public List<FeatureValue> getValues(Locale locale)
      Gets the list of feature values for particular locale.
      Parameters:
      locale - the locale
      Returns:
      the values
    • getValue

      public FeatureValue getValue(Locale locale)
    • getValues

      public List<FeatureValue> getValues()
      Description copied from class: Feature
      Returns the list of feature values. The list is unmodifiable.
      Specified by:
      getValues in class Feature
      Returns:
      the list of feature values
    • getValue

      public FeatureValue getValue()
      Description copied from class: Feature
      Convenience method to return a single value. If the value list is empty this method will return null. If the list's size is greater that one it will return the first element.
      Specified by:
      getValue in class Feature
      Returns:
      method to return a single value
    • addValue

      public void addValue(FeatureValue fvalue)
      Description copied from class: Feature
      Add to this feature a FeatureValue
      Specified by:
      addValue in class Feature
      Parameters:
      fvalue - the feature value
    • addValue

      public void addValue(FeatureValue fvalue, Locale locale)
    • addValue

      public void addValue(int index, FeatureValue fvalue)
      Description copied from class: Feature
      Inserts the FeatureValueat the specified index position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      Specified by:
      addValue in class Feature
      Parameters:
      index - the index value
      fvalue - the feature value
    • addValue

      public void addValue(int index, FeatureValue fvalue, Locale locale)
    • removeValue

      public boolean removeValue(FeatureValue fvalue)
      Description copied from class: Feature
      Removes the first occurrence of the given FeatureValue from the feature, if it is present (optional operation). If this UnlocalizedFeature does not contain this FeatureValue, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists). Returns true if the feature contained the specified feature value.
      Specified by:
      removeValue in class Feature
      Parameters:
      fvalue - the FeatureValue to be removed
      Returns:
      true if the feature value was removed successfully
    • removeValue

      public boolean removeValue(FeatureValue fvalue, Locale locale)
    • removeAllValues

      public void removeAllValues()
      Description copied from class: Feature
      Remove all containing FeatureValues from the current feature.
      Specified by:
      removeAllValues in class Feature
    • removeAllValues

      public void removeAllValues(Locale locale)
    • setValues

      public void setValues(List<FeatureValue> fvalues)
      Description copied from class: Feature
      Clears always all FeatureValue of this Feature and add the given List with FeatureValues to this Feature. If the parameter is null the internal FeatureValue List will only be cleared (same behaviour as Feature.removeAllValues()
      Specified by:
      setValues in class Feature
      Parameters:
      fvalues - the list with feature values or null
    • setValues

      public void setValues(List<FeatureValue> fvalues, Locale locale)