public enum BooleanEnum extends Enum<BooleanEnum> implements SimpleDatatype<Boolean>
BooleanEnum
represents a Boolean
as enum type. This may seem pointless in the first place but is
usable for annotations that can not have null
values. However, in this case it is often desirable to express
a default that is neither true
nor false
e.g. if the default can be determined from other values. In
such case you can use BooleanEnum
instead and NULL
as default.Enum Constant and Description |
---|
FALSE
Represents
Boolean.FALSE . |
NULL
Repesents
null . |
TRUE
Represents
Boolean.TRUE . |
Modifier and Type | Method and Description |
---|---|
static BooleanEnum |
fromValue(Boolean value)
This method gets the
BooleanEnum for the given value . |
Boolean |
getValue()
This method returns the raw value of this datatype.
|
boolean |
isFalse()
This method determines if this instance is
FALSE . |
boolean |
isTrue()
This method determines if this instance is
TRUE . |
String |
toString()
|
static BooleanEnum |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static BooleanEnum[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final BooleanEnum TRUE
Boolean.TRUE
.public static final BooleanEnum FALSE
Boolean.FALSE
.public static final BooleanEnum NULL
null
.private final Boolean value
public static BooleanEnum[] values()
for (BooleanEnum c : BooleanEnum.values()) System.out.println(c);
public static BooleanEnum valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic Boolean getValue()
SimpleDatatype
String
, Character
, Boolean
, any type of Number
, any type of java.time.LocalDate
, etc.).getValue
in interface AttributeReadValue<Boolean>
getValue
in interface SimpleDatatype<Boolean>
public boolean isTrue()
TRUE
.true
if TRUE
, false
otherwise.public boolean isFalse()
FALSE
.true
if FALSE
, false
otherwise.public static BooleanEnum fromValue(Boolean value)
BooleanEnum
for the given value
.value
- is the value
of the requested BooleanEnum
.BooleanEnum
.public String toString()
Datatype
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.Copyright © 2001–2016 mmm-Team. All rights reserved.