| Constructor and Description |
|---|
Optional()
Creates a new
Optional without a value. |
Optional(Payload value)
Creates a new
Optional. |
Optional(Payload value,
boolean ignoreNull)
Creates a new
Optional. |
| Modifier and Type | Method and Description |
|---|---|
<Result> Optional<Result> |
convert(Converter<? super Payload,? extends Result> converter)
|
boolean |
equals(Object object) |
Payload |
getValue()
Returns the value this
Optional has been created with, if any. |
Payload |
getValue(Payload fallback)
Returns the value this
Optional has been created with, if any, or
the given fallback payload value. |
Payload |
getValue(Provider<? extends Payload> provider)
|
int |
hashCode() |
boolean |
hasValue()
Returns whether this
Optional has a value. |
<Result> Result |
select(OptionalSelection<? super Payload,? extends Result> selection)
Calls the appropriate method on the given
OptionalSelection. |
String |
toString() |
public Optional()
Optional without a value.public Optional(Payload value)
Optional.value - The value to be used.public boolean hasValue()
Optional has a value.Optional has a value.public Payload getValue() throws NoSuchElementException
Optional has been created with, if any.NoSuchElementException - If this Optional has no value.public Payload getValue(Payload fallback)
Optional has been created with, if any, or
the given fallback payload value.fallback - The fallback payload value to be used.public Payload getValue(Provider<? extends Payload> provider) throws IllegalArgumentException, ProvisioningException
Optional has been created with, if any, or
a payload value provided by the given Provider.provider - The Provider to be used.IllegalArgumentException - If the given Provider is null.ProvisioningException - If the given Provider failed to provide a fallback
payload value.public <Result> Optional<Result> convert(Converter<? super Payload,? extends Result> converter) throws IllegalArgumentException
Result - The result type.converter - The Converter to be used.OptionalSelection.IllegalArgumentException - If the given Converter is null.public <Result> Result select(OptionalSelection<? super Payload,? extends Result> selection) throws IllegalArgumentException
OptionalSelection.Result - The result type.selection - The OptionalSelection to be used.OptionalSelection.IllegalArgumentException - If the given OptionalSelection is null.Copyright © 2015–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.