Class Attribute

java.lang.Object
com.broadleafcommerce.catalog.domain.Attribute
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, Serializable

public class Attribute extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
Many entities have customizable dynamic attributes, and this class is intended to hold such values.

Attributes are placed on domain objects as a map of attribute names to attribute values: Map<String, Attribute>.

Author:
Samarth Dhruva
See Also:
  • Field Summary

    Fields inherited from interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware

    DEFAULT_FIELD_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Attribute(Object value, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
    Constructor for preserving backwards compatibility with Attributes that do not have a nameLabel
    Attribute(Object value, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState, String nameLabel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    boolean
     
    com.broadleafcommerce.data.tracking.core.EmbeddedContextState
    A subset of Tracking information to expose the context state for this object.
    A additional label that can be used to identify this attribute.
    The value represented by this attribute.
    int
     
    void
    setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
    A subset of Tracking information to expose the context state for this object.
    void
    setNameLabel(String nameLabel)
    A additional label that can be used to identify this attribute.
    void
    The value represented by this attribute.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Attribute

      public Attribute(Object value, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
      Constructor for preserving backwards compatibility with Attributes that do not have a nameLabel
      Parameters:
      value - the value represented by this attribute
      contextState - a subset of Tracking information to expose the context state for this object
    • Attribute

      public Attribute(Object value, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState, String nameLabel)
    • Attribute

      public Attribute()
  • Method Details

    • getValue

      public Object getValue()
      The value represented by this attribute. Attributes are generally placed on domain objects as a map of attribute names to attribute values: Map<String, Attribute>.
      Returns:
      the value represented by this attribute
    • getContextState

      public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • getNameLabel

      public String getNameLabel()
      A additional label that can be used to identify this attribute.
      Returns:
      an additional label for the attribute
    • setValue

      public void setValue(Object value)
      The value represented by this attribute. Attributes are generally placed on domain objects as a map of attribute names to attribute values: Map<String, Attribute>.
      Parameters:
      value - the value represented by this attribute
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • setNameLabel

      public void setNameLabel(String nameLabel)
      A additional label that can be used to identify this attribute.
      Parameters:
      nameLabel - an additional label for the attribute
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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