Class DataDrivenEnum
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,Serializable
For example, if the Product
domain had a field that only allows certain values while
needing to be managed via the admin, such as "material" or "brand", then it would be useful to
map data driven enums with different values based on their types
.
- Author:
- Sunny Yu
- See Also:
-
Constructor Summary
ConstructorDescriptionDataDrivenEnum
(String id, String type, String value, String displayValue, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information to expose the context state for this object.The display value for the associatedtype
.getId()
The context ID of this enum.getType()
Identifies the type of the associated value, this is needed to gather all the enumvalues
based on their types.getValue()
The value of the associatedtype
.int
hashCode()
void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setDisplayValue
(String displayValue) The display value for the associatedtype
.void
The context ID of this enum.void
Identifies the type of the associated value, this is needed to gather all the enumvalues
based on their types.void
The value of the associatedtype
.toString()
-
Constructor Details
-
DataDrivenEnum
public DataDrivenEnum() -
DataDrivenEnum
-
-
Method Details
-
getId
The context ID of this enum.- Returns:
- the context ID of this enum
-
getType
Identifies the type of the associated value, this is needed to gather all the enumvalues
based on their types.For example, if this enum type was to be used for a field representing product's materials, then the type would be "MATERIAL".
- Returns:
- the type for the associated value
-
getValue
The value of the associatedtype
.For example, the value for type "MATERIAL" could be "COTTON", "LEATHER", "POLYESTER", etc.
- Returns:
- the value of the associated type
-
getDisplayValue
The display value for the associatedtype
.Different from
value
, the display value is meant to be more user-friendly and for client-facing usages, such as searching and faceting.For example, the display value for type "MATERIAL" could be "Cotton", "Leather", "Polyester", etc.
- Returns:
- the display value of the associated type
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
setId
The context ID of this enum.- Parameters:
id
- the context ID of this enum
-
setType
Identifies the type of the associated value, this is needed to gather all the enumvalues
based on their types.For example, if this enum type was to be used for a field representing product's materials, then the type would be "MATERIAL".
- Parameters:
type
- the type for the associated value
-
setValue
The value of the associatedtype
.For example, the value for type "MATERIAL" could be "COTTON", "LEATHER", "POLYESTER", etc.
- Parameters:
value
- the value of the associated type
-
setDisplayValue
The display value for the associatedtype
.Different from
value
, the display value is meant to be more user-friendly and for client-facing usages, such as searching and faceting.For example, the display value for type "MATERIAL" could be "Cotton", "Leather", "Polyester", etc.
- Parameters:
displayValue
- the display value of the associated type
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-