TYPE
- is the generic type of the enum type
.CATEGORY
- is the generic type of the category
or Void
for none.public interface EnumDefinition<TYPE,CATEGORY> extends SimpleDatatype<String>
EnumType
. EnumDefinition
<Iso2CountryCode, Void>. This defines an enumeration based on the type Iso2CountryCode
that has no
category
. Next, we define another instance of this interface called state
defined as
EnumDefinition
<StateDatatype, Iso2CountryCode>. The method getCategory()
will return the
country instance we defined earlier. This means that a state is classified by a county. value
is used as identifier key and has to be unique.Modifier and Type | Method and Description |
---|---|
EnumDefinition<CATEGORY,?> |
getCategory() |
Class<TYPE> |
getEnumType() |
Formatter<TYPE> |
getFormatter()
|
String |
getValue()
This method returns the raw value of this datatype.
|
boolean |
isCachable() |
boolean |
isMutable() |
EnumDefinition<CATEGORY,?> getCategory()
EnumDefinition
this EnumDefinition
is categorized by or null
for no category
(then <CATEGORY> shall be bound to Void
).Formatter<TYPE> getFormatter()
Formatter
used to format
instances of the enum as
String
for end-users. By default FormatterToString
can be used. However,
e.g. for the type Boolean
you might want to display as "yes" or "no" and might have an alternative
EnumDefinition
for Boolean
that displays as "all" or "none". Further, also I18N (see
NlsMessage
) can be addressed by this Formatter
.EnumDefinition
may be used with or without allowing a null
value. Therefore, this
Formatter
should be able to properly format null
(see
AbstractFormatter
.formatNull()
). E.g. a Boolean
option in a
search form may be optional and displayed as "any".Formatter
.Class<TYPE> getEnumType()
EnumType
of this EnumDefinition
.boolean isMutable()
boolean isCachable()
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 SimpleDatatype<String>
Copyright © 2001–2016 mmm-Team. All rights reserved.