TYPE - is the generic type of the enum type.CATEGORY - is the generic type of the category or Void for none.public class EnumEnumDefinition<TYPE extends Enum<TYPE>,CATEGORY> extends AbstractEnumDefinition<TYPE,CATEGORY>
EnumDefinition for a java Enum. EnumProvider. From out-side use
EnumProvider.getEnumDefinition(Class) instead.| Modifier and Type | Class and Description |
|---|---|
protected class |
EnumEnumDefinition.EnumDefaultFormatter
|
protected class |
EnumEnumDefinition.EnumTypeFormatter
|
| Modifier and Type | Field and Description |
|---|---|
private EnumDefinition<CATEGORY,?> |
category |
private Class<TYPE> |
enumType |
private List<TYPE> |
enumValues |
private static long |
serialVersionUID
UID for serialization.
|
private StringUtil |
stringUtil |
private String |
title |
private String |
value |
| Modifier | Constructor and Description |
|---|---|
|
EnumEnumDefinition(Class<TYPE> enumType,
EnumDefinition<CATEGORY,?> category,
StringUtil stringUtil)
The constructor.
|
private |
EnumEnumDefinition(Class<TYPE> enumType,
NodeCycle<Class<?>> cycle,
EnumDefinition<CATEGORY,?> category,
StringUtil stringUtil)
The constructor.
|
|
EnumEnumDefinition(Class<TYPE> enumType,
StringUtil stringUtil)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
EnumDefinition<CATEGORY,?> |
getCategory() |
Class<TYPE> |
getEnumType() |
List<TYPE> |
getEnumValues() |
protected String |
getKey(Class<TYPE> type)
This method is called from the constructor to set the
value. |
String |
getValue()
This method returns the raw value of this datatype.
|
boolean |
isCachable() |
boolean |
isMutable() |
String |
toString()
|
getFormatter, setFormatterprivate static final long serialVersionUID
private String value
getValue()private String title
toString()private EnumDefinition<CATEGORY,?> category
getCategory()private Class<TYPE extends Enum<TYPE>> enumType
getEnumType()private List<TYPE extends Enum<TYPE>> enumValues
getEnumValues()private StringUtil stringUtil
EnumEnumDefinition.EnumDefaultFormatterpublic EnumEnumDefinition(Class<TYPE> enumType, StringUtil stringUtil)
category is automatically detected.enumType - - see getEnumType().stringUtil - is the StringUtil instance to use.public EnumEnumDefinition(Class<TYPE> enumType, EnumDefinition<CATEGORY,?> category, StringUtil stringUtil)
enumType - - see getEnumType().category - is the explicit category (if not realized by an Enum or
auto-detection not desired for other reasons).stringUtil - is the StringUtil instance to use.private EnumEnumDefinition(Class<TYPE> enumType, NodeCycle<Class<?>> cycle, EnumDefinition<CATEGORY,?> category, StringUtil stringUtil)
enumType - - see getEnumType().cycle - is a NodeCycle instance to detect cyclic categories.category - is the category or null for auto-detect / none.stringUtil - is the StringUtil instance to use.protected String getKey(Class<TYPE> type)
value. By default it returns the
qualified name of getEnumType(). Override to change (e.g. to
simple name).getKey in class AbstractEnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>type - is the getEnumType().getValue() to use.public String getValue()
String, Character, Boolean, any type of Number, any type of
java.time.LocalDate, etc.).
enum type and has to be unique for
all available enumerations.getValue in interface AttributeReadValue<String>getValue in interface EnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>getValue in interface SimpleDatatype<String>getValue in class AbstractEnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>public String toString()
String representation of this Datatype. While the general contract
of Object.toString() is very weak and mainly used for debugging, the contract here is very
strong. The returned String has to be suitable for end-users and official output to any kind of
sink. NlsMessage for this purpose and implement
NlsObject if you want to support I18N/L10N.public EnumDefinition<CATEGORY,?> getCategory()
EnumDefinition this EnumDefinition is categorized by or null for
no category (then <CATEGORY> shall be bound to Void).public Class<TYPE> getEnumType()
EnumType of this EnumDefinition.public List<TYPE> getEnumValues()
getEnumValues in class AbstractEnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>List of the enum values.public boolean isMutable()
public boolean isCachable()
isCachable in interface EnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>isCachable in class AbstractEnumDefinition<TYPE extends Enum<TYPE>,CATEGORY>true if all EnumType-instances of this type can
cached (default) or false if there are too many of them (e.g. for entities like
cities of the world).Copyright © 2001–2015 mmm-Team. All rights reserved.