public class AttributeChoice extends Object implements Serializable
Variants
.allowedValues
,
Serialized FormConstructor and Description |
---|
AttributeChoice() |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String name,
Object value)
Takes in any additional attributes passed in the request not matching any defined properties.
|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
List<AttributeChoiceValue> |
getAllowedValues()
Gives the customer more structured input to fill out their option, which can drive a select
field or a color picker with particular colors.
|
Map<String,Object> |
getAttribute()
Return any additional attributes passed in the request not matching any defined properties.
|
String |
getAttributeName()
The order or item attribute that this choice is stored in when the user adds to their cart
|
Map<String,Object> |
getAttributes()
Map holding any additional attributes passed in the request not matching any defined
properties.
|
String |
getErrorCode()
In case of a validation failure in conjunction with a
getValidationStrategy() this
is the error code that should be shown to customers. |
String |
getErrorMessage()
In case of a validation failure in conjunction with a
getValidationStrategy() this
is the message that should be shown to customers. |
String |
getValidationRule()
If
validationType is regex , this is the expression that
should execute against the user's value. |
String |
getValidationStrategy()
The strategy used to determine when this product option is validated.
|
String |
getValidationType()
How the validation from
getValidationStrategy() should be performed. |
int |
hashCode() |
boolean |
isRequired()
Whether or not the user is required to fill out this option in order to add the product to
their cart.
|
void |
setAllowedValues(List<AttributeChoiceValue> allowedValues)
Gives the customer more structured input to fill out their option, which can drive a select
field or a color picker with particular colors.
|
void |
setAttributeName(String attributeName)
The order or item attribute that this choice is stored in when the user adds to their cart
|
void |
setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined
properties.
|
void |
setErrorCode(String errorCode)
In case of a validation failure in conjunction with a
getValidationStrategy() this
is the error code that should be shown to customers. |
void |
setErrorMessage(String errorMessage)
In case of a validation failure in conjunction with a
getValidationStrategy() this
is the message that should be shown to customers. |
void |
setRequired(boolean required)
Whether or not the user is required to fill out this option in order to add the product to
their cart.
|
void |
setValidationRule(String validationRule)
If
validationType is regex , this is the expression that
should execute against the user's value. |
void |
setValidationStrategy(String validationStrategy)
The strategy used to determine when this product option is validated.
|
void |
setValidationType(String validationType)
How the validation from
getValidationStrategy() should be performed. |
String |
toString() |
public void addAttribute(String name, Object value)
name
- Name of the additional attributevalue
- Value of the additional attributepublic Map<String,Object> getAttribute()
public String getAttributeName()
When used to distinguish variants, this field corresponds to a key in
Variant.getOptionValues()
.
public boolean isRequired()
public String getValidationStrategy()
required
and
allowedValues
are always validated.public String getValidationType()
getValidationStrategy()
should be performed. Only
relevant if getValidationStrategy()
is non-nullValidationType
public String getValidationRule()
validationType
is regex
, this is the expression that
should execute against the user's value.getValidationStrategy()
public String getErrorMessage()
getValidationStrategy()
this
is the message that should be shown to customers. Intended to be displayed directly on the
page when the getValidationStrategy()
fails validation.getValidationStrategy()
public String getErrorCode()
getValidationStrategy()
this
is the error code that should be shown to customers. This could map into a special message
key on the frontend or provide additional information to the user in addition to
getErrorMessage()
.getValidationStrategy()
getErrorMessage()
public List<AttributeChoiceValue> getAllowedValues()
When used to distinguish variants, a value in this list should correspond to the value in a
variant's Variant.getOptionValues()
map for the attributeName
key.
public Map<String,Object> getAttributes()
public void setAttributeName(String attributeName)
When used to distinguish variants, this field corresponds to a key in
Variant.getOptionValues()
.
name
- attribute that this choice is stored into, either on the order item or orderpublic void setRequired(boolean required)
required
- whether selecting a value from this option is required before adding this
product to the cartpublic void setValidationStrategy(String validationStrategy)
required
and
allowedValues
are always validated.validationStrategy
- when this choice should be validatedpublic void setValidationType(String validationType)
getValidationStrategy()
should be performed. Only
relevant if getValidationStrategy()
is non-nullvalidationType
- how validation should be performedValidationType
public void setValidationRule(String validationRule)
validationType
is regex
, this is the expression that
should execute against the user's value.validationRule
- the rule used to validate the user inputpublic void setErrorMessage(String errorMessage)
getValidationStrategy()
this
is the message that should be shown to customers. Intended to be displayed directly on the
page when the getValidationStrategy()
fails validation.errorMessage
- message that customers see on invalid inputpublic void setErrorCode(String errorCode)
getValidationStrategy()
this
is the error code that should be shown to customers. This could map into a special message
key on the frontend or provide additional information to the user in addition to
getErrorMessage()
.errorCode
- additional information that should be shown when
getValidationStrategy()
is non-null and validation failsgetErrorMessage()
public void setAllowedValues(List<AttributeChoiceValue> allowedValues)
When used to distinguish variants, a value in this list should correspond to the value in a
variant's Variant.getOptionValues()
map for the attributeName
key.
allowedValues
- the potential values that a customer can inputpublic void setAttributes(Map<String,Object> attributes)
protected boolean canEqual(Object other)
Copyright © 2021. All rights reserved.