@Retention(value=RUNTIME) @Inherited @Target(value={FIELD,METHOD,ANNOTATION_TYPE}) public @interface EnumOptions
EnumSelector
annotation is meant to be used in conjunction with enumeration attributes.
Values parsed from the input will be matched against one or more properties of the enumeration type. By default, values read from the input will be matched against:
Enum.name()
- the name of the elements in the enumeration typeEnum.ordinal()
- the ordinal of the elements in the enumeration typeEnum.toString()
- the String
representation of the elements in the enumeration type customElement()
of your enumeration type (an attribute or method), as long as it
uniquely identifies each value of your enumeration type.
Use the selectors()
option to choose which properties to match the parsed input against, and in what order. You will only need to
explicitly add a EnumSelector.CUSTOM_FIELD
or EnumSelector.CUSTOM_METHOD
to the list of selectors()
if your customElement()
name
could point to both an attribute and a method in your enumeration.
This will assign an EnumConversion
to this field.
Commonly used for java beans processed using BeanProcessor
and/or BeanWriterProcessor
BeanProcessor
,
BeanWriterProcessor
Modifier and Type | Optional Element and Description |
---|---|
String |
customElement
Defines the name of a custom element (attribute or method) of the annotated enumeration.
|
EnumSelector[] |
selectors
A list of properties of the enumeration type that will be matched against the parsed input to identify which enum element should be assigned to the annotated field.
|
public abstract EnumSelector[] selectors
A list of properties of the enumeration type that will be matched against the parsed input to identify which enum element should be assigned to the annotated field. By default, values read from the input will be matched against:
Enum.name()
- the name of the elements in the enumeration typeEnum.ordinal()
- the ordinal of the elements in the enumeration typeEnum.toString()
- the String
representation of the elements in the enumeration type public abstract String customElement
You will only need to explicitly add a EnumSelector.CUSTOM_FIELD
or EnumSelector.CUSTOM_METHOD
to the list of selectors()
if your customElement()
name could point to both an attribute and a method in your enumeration.
Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.