public interface Weak<Self extends Weak<Self>>
| Modifier and Type | Method and Description |
|---|---|
default <T> T |
as(Class<T> type)
As
asObject() casting to input type |
default <T> List<T> |
asList()
Shortcut for as(List.class), with malleable generic type
|
default <K,V> Map<K,V> |
asMap()
Shortcut for as(Map.class), with malleable generic type
|
Object |
asObject()
Returns inner value implicitly asserting that the value is not absent, ie
isPresent() is true |
default Optional<Object> |
asOptional()
Converts this value/absence wrapper into a standard optional
|
default String |
asString()
Shortcut for as(String.class)
|
default Converter |
convert()
Shortcut for wrapping
asObject() in a Converter instance |
default boolean |
is(Class<?> type) |
default boolean |
isList()
Shortcut for is(List.class)
|
default boolean |
isMap()
Shortcut for is(Map.class)
|
boolean |
isPresent()
Returns if this instance wraps a non-null value.
|
default boolean |
isString()
Shortcut for is(String.class)
|
default OptionalWeak<Self> |
maybe()
Returns an optional wrapping of this instance, with resultant
Optional.isPresent() return consistent with isPresent() |
boolean isPresent()
asObject() will not throwObject asObject()
isPresent() is trueNoSuchElementException - absentdefault Optional<Object> asOptional()
Optional.isPresent() to isPresent()default <T> T as(Class<T> type)
asObject() casting to input typeT - cast typetype - cast typeClassCastException - when the wrapped instance that cannot be cast to the inputNoSuchElementException - absentdefault <T> List<T> asList()
as(Class)default <K,V> Map<K,V> asMap()
as(Class)default boolean is(Class<?> type)
type - type to test inner value withdefault boolean isMap()
is(Class)default boolean isString()
is(Class)default boolean isList()
is(Class)default Converter convert()
asObject() in a Converter instanceConverter instance for inner valueNoSuchElementException - absentConverter.convert(Object)default OptionalWeak<Self> maybe()
Optional.isPresent() return consistent with isPresent()Copyright © 2017. All rights reserved.