Class SelectOption
java.lang.Object
com.broadleafcommerce.metadata.dsl.core.extension.fields.SelectOption
- All Implemented Interfaces:
Copyable<SelectOption>
,Serializable
Represents an option within a
SelectField
.- Author:
- Nick Crum (ncrum)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An enum interface used as a method for defining a finite list ofSelectOption
. -
Constructor Summary
ConstructorsConstructorDescriptionSelectOption
(SelectOption option) SelectOption
(String value, InternationalizedMessage label) SelectOption
(String value, String labelKey) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
copy()
boolean
static List<SelectOption>
Returns the list of all installed locales converted toSelectOption
.static List<SelectOption>
fromEnums
(SelectOption.SelectOptionEnum[] optionEnums) Factory method to generate a set ofSelectOption
from the passed enumeration.static List<SelectOption>
fromLocales
(List<Locale> locales) Returns the list of the specified locales converted toSelectOption
.static List<SelectOption>
Returns the list of allZoneId.getAvailableZoneIds()
converted toSelectOption
.static List<SelectOption>
fromTimeZones
(Set<String> zoneIds) Returns the list of the specified time-zones converted toSelectOption
.getColor()
Optional color to display alongside the labelgetLabel()
The user-friendly text that the user sees as the select optiongetValue()
The underlying form value that the user selectsint
hashCode()
label
(InternationalizedMessage label)
-
Constructor Details
-
SelectOption
public SelectOption() -
SelectOption
-
SelectOption
-
SelectOption
-
-
Method Details
-
copy
- Specified by:
copy
in interfaceCopyable<SelectOption>
- Returns:
- a deep copy of this instance
-
value
-
label
-
label
-
color
-
attribute
-
fromEnums
Factory method to generate a set ofSelectOption
from the passed enumeration.- Parameters:
optionEnums
- the enums- Returns:
- the set of options
-
fromAllLocales
Returns the list of all installed locales converted toSelectOption
. Notably, only locales fitting an ISO 639-1 two character language code, or an ISO 3166 two character country code, or a combination of the two will be returned. Any other locales will be stripped from the results.- Returns:
- the list of all installed locales converted to
SelectOption
- See Also:
-
fromLocales
Returns the list of the specified locales converted toSelectOption
. The value is retrieved fromLocale.toLanguageTag()
. The label represents the message property e.g. "locales.en-GB=English (GB)", where "en-GB" is retrieved fromLocale.toLanguageTag()
.- Parameters:
locales
- the locales to convert- Returns:
- the list of locales converted to
SelectOption
-
fromTimeZones
Returns the list of allZoneId.getAvailableZoneIds()
converted toSelectOption
.- Returns:
- the list of all
ZoneId.getAvailableZoneIds()
converted toSelectOption
-
fromTimeZones
Returns the list of the specified time-zones converted toSelectOption
. The value is the time-zone ID. The label represents the message property e.g. "time.zone.id.america_new_york=America/New_York".- Parameters:
zoneIds
- the list of zone IDs- Returns:
- the list of zone IDs converted to
SelectOption
-
getValue
The underlying form value that the user selects -
getLabel
The user-friendly text that the user sees as the select option
This label can be a message key for I18n concerns
-
getColor
Optional color to display alongside the label -
getAttributes
-
equals
-
canEqual
-
hashCode
public int hashCode()
-