T
- the value typepublic final class Value<T> extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
AstAttributeElement |
getDeclaration()
Returns the declaration.
|
T |
getEntity()
Returns the entity.
|
int |
hashCode() |
void |
ifPresent(Consumer<T> action)
Accepts the entity only if this value is present.
|
boolean |
isDefined()
Returns whether or not this value is explicitly defined.
|
boolean |
isPresent()
Returns whether or not this value is present.
|
static <T> Value<T> |
of(AstAttributeElement declaration,
T entity)
Returns a new value.
|
Value<T> |
orDefault(Value<T> defaultValue)
Returns this if defined, or the default value.
|
T |
orElse(T defaultValue)
Returns this if defined, or the default value.
|
String |
toString() |
static <T> Value<T> |
undefined()
Returns an undefined value.
|
public static <T> Value<T> undefined()
T
- the value typepublic static <T> Value<T> of(AstAttributeElement declaration, T entity)
T
- the value typedeclaration
- the original declarationentity
- the actual valuepublic T orElse(T defaultValue)
defaultValue
- the default value.public Value<T> orDefault(Value<T> defaultValue)
defaultValue
- the default value.public AstAttributeElement getDeclaration()
public boolean isDefined()
true
if it is definedpublic boolean isPresent()
true
if it is presentpublic void ifPresent(Consumer<T> action)
action
- the actionpublic T getEntity()
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.