public final class OptionalDynamic<T> extends DynamicLike<T>
ops| Constructor and Description |
|---|
OptionalDynamic(DynamicOps<T> ops,
DataResult<Dynamic<T>> delegate) |
| Modifier and Type | Method and Description |
|---|---|
DataResult<ByteBuffer> |
asByteBufferOpt()
Coerces and returns the wrapped value as a
ByteBuffer in a DataResult. |
DataResult<IntStream> |
asIntStreamOpt()
Coerces and returns the wrapped value as a stream of int values in a
DataResult. |
DataResult<LongStream> |
asLongStreamOpt()
Coerces and returns the wrapped value as a stream of long values in a
DataResult. |
DataResult<Stream<(Dynamic<T>,Dynamic<T>)>> |
asMapOpt()
Coerces and returns the wrapped value as a map of entries in a
DataResult. |
DataResult<Number> |
asNumber()
Coerces and returns the wrapped value as a number in a
DataResult. |
DataResult<Stream<Dynamic<T>>> |
asStreamOpt()
Coerces and returns the wrapped value as a stream of values in a
DataResult. |
DataResult<String> |
asString()
Coerces and returns the wrapped value as a string in a
DataResult. |
<A> DataResult<(A,T)> |
decode(Decoder<? extends A> decoder)
Decodes an object using the given
Decoder, and returns a DataResult containing a pair
of the decoded object and the remaining serialized value. |
<U> DataResult<U> |
flatMap((? super Dynamic<T>) -> ? extends DataResult<U> mapper) |
DataResult<Dynamic<T>> |
get() |
OptionalDynamic<T> |
get(String key)
If the given key is present in the wrapped value, returns the value associated with it, else returns empty.
|
DataResult<T> |
getElement(String key)
If the given key is present in the wrapped value, returns the value associated with it, else returns empty.
|
DataResult<T> |
getElementGeneric(T key)
If the key represented by the given serialized value is present in the wrapped value, returns the value
associated with it, else returns empty.
|
DataResult<T> |
getGeneric(T key)
If the key represented by the given serialized value is present in the wrapped value, returns the value
associated with it, else returns empty.
|
<V> DataResult<V> |
into((? super Dynamic<T>) -> ? extends V action) |
<U> DataResult<U> |
map((? super Dynamic<T>) -> U mapper) |
Dynamic<T> |
orElseEmptyList() |
Dynamic<T> |
orElseEmptyMap() |
Optional<Dynamic<T>> |
result() |
asBoolean, asByte, asByteBuffer, asDouble, asFloat, asInt, asIntStream, asList, asListOpt, asLong, asLongStream, asMap, asMapOpt, asNumber, asShort, asStream, asString, createBoolean, createByte, createByteList, createDouble, createFloat, createInt, createIntList, createList, createLong, createLongList, createMap, createNumeric, createShort, createString, emptyList, emptyMap, getElement, getElementGeneric, getOps, read, readList, readList, readMap, readMap, readMappublic OptionalDynamic(DynamicOps<T> ops, DataResult<Dynamic<T>> delegate)
public DataResult<Dynamic<T>> get()
public <U> DataResult<U> map((? super Dynamic<T>) -> U mapper)
public <U> DataResult<U> flatMap((? super Dynamic<T>) -> ? extends DataResult<U> mapper)
public DataResult<Number> asNumber()
DynamicLikeDataResult.asNumber in class DynamicLike<T>DynamicOps.getNumberValue(Object)public DataResult<String> asString()
DynamicLikeDataResult.asString in class DynamicLike<T>DynamicOps.getStringValue(Object)public DataResult<Stream<Dynamic<T>>> asStreamOpt()
DynamicLikeDataResult.asStreamOpt in class DynamicLike<T>DynamicOps.getStream(Object)public DataResult<Stream<(Dynamic<T>,Dynamic<T>)>> asMapOpt()
DynamicLikeDataResult.asMapOpt in class DynamicLike<T>DynamicOps.getMapValues(Object)public DataResult<ByteBuffer> asByteBufferOpt()
DynamicLikeByteBuffer in a DataResult.asByteBufferOpt in class DynamicLike<T>DynamicOps.getByteBuffer(Object)public DataResult<IntStream> asIntStreamOpt()
DynamicLikeDataResult.asIntStreamOpt in class DynamicLike<T>DynamicOps.getIntStream(Object)public DataResult<LongStream> asLongStreamOpt()
DynamicLikeDataResult.asLongStreamOpt in class DynamicLike<T>DynamicOps.getLongStream(Object)public OptionalDynamic<T> get(String key)
DynamicLikeget in class DynamicLike<T>key - The key to search for.OptionalDynamic.public DataResult<T> getGeneric(T key)
DynamicLikegetGeneric in class DynamicLike<T>key - The key to search for.DataResult.public DataResult<T> getElement(String key)
DynamicLikegetElement in class DynamicLike<T>key - The key to search for.DataResult.DynamicLike.get(String)public DataResult<T> getElementGeneric(T key)
DynamicLikegetElementGeneric in class DynamicLike<T>key - The key to search for.DataResult.DynamicLike.getGeneric(Object)public <V> DataResult<V> into((? super Dynamic<T>) -> ? extends V action)
public <A> DataResult<(A,T)> decode(Decoder<? extends A> decoder)
DynamicLikeDecoder, and returns a DataResult containing a pair
of the decoded object and the remaining serialized value.decode in class DynamicLike<T>A - The type of the decoded object.decoder - The decoder to use.DataResult containing the decoded object and the remaining serialized value.