public class EnumProperty<T extends Enum<T> & StringIdentifiable> extends Property<T>
Property.Value<T extends Comparable<T>>
Modifier and Type | Field and Description |
---|---|
private Map<String,T> |
byName |
private ImmutableSet<T> |
values |
Modifier | Constructor and Description |
---|---|
protected |
EnumProperty(String name,
Class<T> type,
Collection<T> values) |
Modifier and Type | Method and Description |
---|---|
int |
computeHashCode() |
boolean |
equals(Object object) |
Collection<T> |
getValues()
Returns all possible values the property can take.
|
String |
name(T t) |
static <T extends Enum<T> & StringIdentifiable> |
of(String name,
Class<T> type)
Creates an enum property.
|
static <T extends Enum<T> & StringIdentifiable> |
of(String name,
Class<T> type,
Collection<T> values)
Creates an enum property.
|
static <T extends Enum<T> & StringIdentifiable> |
of(String name,
Class<T> type,
Predicate<T> filter)
Creates an enum property.
|
static <T extends Enum<T> & StringIdentifiable> |
of(String name,
Class<T> type,
T[] values) |
Optional<T> |
parse(String name) |
createValue, createValue, getName, getType, getValueCodec, hashCode, stream, toString
private final ImmutableSet<T extends Enum<T> & StringIdentifiable> values
protected EnumProperty(String name, Class<T> type, Collection<T> values)
public Collection<T> getValues()
public boolean equals(Object object)
public int computeHashCode()
computeHashCode
in class Property<T extends Enum<T> & StringIdentifiable>
public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type)
name
- the name of this propertytype
- the type this property containspublic static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, Predicate<T> filter)
name
- the name of this propertytype
- the type this property containsfilter
- a filter that specifies if a value is allowedpublic static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, T[] values)
public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, Collection<T> values)
name
- the name of this propertytype
- the type this property containsvalues
- the values this property could contain