Class AttributeChoiceValue

java.lang.Object
com.broadleafcommerce.catalog.domain.product.option.AttributeChoiceValue
All Implemented Interfaces:
com.broadleafcommerce.translation.mapping.SubIdentifiable, Serializable, Comparable<AttributeChoiceValue>

public class AttributeChoiceValue extends Object implements Serializable, Comparable<AttributeChoiceValue>, com.broadleafcommerce.translation.mapping.SubIdentifiable
A single value with a display, order and label within a AttributeChoice
Author:
Phillip Verheyden (phillipuniverse)
See Also:
  • Constructor Details

    • AttributeChoiceValue

      public AttributeChoiceValue(String label, String value, Integer displayOrder)
    • AttributeChoiceValue

      public AttributeChoiceValue()
  • Method Details

    • compareTo

      public int compareTo(@NonNull AttributeChoiceValue o)
      Order by the displayOrder and then the label with nulls last
      Specified by:
      compareTo in interface Comparable<AttributeChoiceValue>
    • getId

      public String getId()
      Specified by:
      getId in interface com.broadleafcommerce.translation.mapping.SubIdentifiable
      See Also:
      • SubIdentifiable.getId()
    • getLabel

      public String getLabel()
      What the customer sees for display. For example, text in the case of sizes or a hex value in the case of colors. Can diverge from value which is what is added to the cart
      Returns:
      the customer-facing display. If null, the getValue() should be used for display
    • getValue

      public String getValue()
      The value stored as an item attribute or cart attribute based on what the user selects. This field is required, but can be different than the customer-facing display in label
      Returns:
      the value that should be stored as an item/cart attribute when the user selects this choice
    • getDisplayOrder

      public Integer getDisplayOrder()
      How this value displays in the context of all other values within a single AttributeChoice
      Returns:
      the ordering of this value or {@link null} in which case this should be ordered at the end
    • setId

      public void setId(String id)
      Specified by:
      setId in interface com.broadleafcommerce.translation.mapping.SubIdentifiable
      See Also:
      • SubIdentifiable.getId()
    • setLabel

      public void setLabel(String label)
      What the customer sees for display. For example, text in the case of sizes or a hex value in the case of colors. Can diverge from value which is what is added to the cart
      Parameters:
      label - customer-facing display of this value
    • setValue

      public void setValue(String value)
      The value stored as an item attribute or cart attribute based on what the user selects. This field is required, but can be different than the customer-facing display in label
      Parameters:
      value - what will be stored as an item/cart attribute
    • setDisplayOrder

      public void setDisplayOrder(Integer displayOrder)
      How this value displays in the context of all other values within a single AttributeChoice
      Parameters:
      displayOrder - ordering of this value in relation to other values in the same AttributeChoice
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object