public final class Alias extends Object
isPresent() will
return true and getValue() will return the value.
Additional methods that depend on the presence or absence of a contained value are provided, such as
hasValue(Object) or isPresent()
Aliases are immutable once created.| Modifier and Type | Field and Description |
|---|---|
static Alias |
NONE
Common instance for
empty(). |
| Modifier and Type | Method and Description |
|---|---|
static Alias |
empty()
Returns an empty
Alias instance. |
boolean |
equals(Object o) |
Object |
getValue() |
int |
hashCode() |
boolean |
hasSamePresentValueAs(Alias other)
Returns whether the the current alias is present and has the same value as the given
Alias. |
boolean |
hasValue(Object that)
Checks whether this
Alias contains the value that. |
boolean |
isPresent() |
boolean |
isPresentButDifferent(Alias other)
Checks whether this
Alias has a value but is different from the other value. |
<T> T |
mapTyped(Class<T> type)
Return the value typed to
type if the value is present and assignable to type. |
static Alias |
of(Object alias)
Create an
Alias given the alias object. |
static Alias |
ofNullable(Object alias)
Create an
Alias from a possibly present alias object. |
String |
toString() |
public static final Alias NONE
empty().public static Alias of(Object alias)
Alias given the alias object.alias - must not be null.Alias for alias.public static Alias empty()
Alias instance. No value is present for this Alias.Alias.public boolean isPresentButDifferent(Alias other)
Alias has a value but is different from the other value.other - must not be null.other value.public boolean hasValue(Object that)
Alias contains the value that.that - the other value, may be null.that.public boolean hasSamePresentValueAs(Alias other)
Alias.public boolean isPresent()
Alias contains a value.@Nullable public <T> T mapTyped(Class<T> type)
type if the value is present and assignable to type.type - must not be null.public Object getValue()
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.