Class LocalizedValue

java.lang.Object
de.hybris.platform.integrationservices.item.LocalizedValue

public class LocalizedValue extends Object
A value object for localized attributes. This object captures values for possible different locales the attributes may be set to.
  • Field Details

    • EMPTY

      public static final LocalizedValue EMPTY
      An empty localized value that does not contain any localized values.
  • Method Details

    • of

      public static LocalizedValue of(Locale locale, Object value)
      Creates instance with a single localized value set for the specified locale.
      Parameters:
      locale - non-null value specifying in what locale the value is.
      value - a nullable locale specific value.
      Returns:
      new instance with the value set.
      Throws:
      IllegalArgumentException - if locale is null
    • get

      public Object get(Locale locale)
      Reads back a value set for the specified locale.
      Parameters:
      locale - a locale to read the value for.
      Returns:
      a value last set for the locale or null, if a value for the specified locale has never been set yet.
      See Also:
    • forEach

      public void forEach(BiConsumer<Locale,Object> consumer)
      Applies the consumer operation to each Locale and value
      Parameters:
      consumer - Consumes the Locale and value
    • combine

      public LocalizedValue combine(Locale locale, Object value)
      Sets value for a specific locale. Keep in mind this method does not mutate this localized value, therefore to see the change the returned object must be used.
      Parameters:
      locale - a locale to set the value for.
      value - a value for the specified locale.
      Returns:
      a new instance of the LocalizedValue, which contains the value for the specified locale
      Throws:
      IllegalArgumentException - if locale is null
    • combine

      public LocalizedValue combine(LocalizedValue value)
      Sets all values available in the specified LocalizedValue. Keep in mind this method does not mutate this localized value, therefore to see the change the returned object must be used.
      Parameters:
      value - a value to be combined with this LocalizedValue.
      Returns:
      a new instance of the LocalizedValue, which contains all localized values from this and and the specified LocalizedValue
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object