public class TypedRef<V,R> extends Object
Usage: mark value and its ref type.
Map<String, Integer> map = new HashMap<>();
TypedRef<String, Integer> ref = new TypedRef<>("key");
map.put("key", 42);
Integer result = ref.get(map, false);
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
R |
get(@NotNull Function<V,R> fun,
boolean nonnull) |
R |
get(@NotNull Map<V,? extends R> map,
boolean nonnull) |
R |
getOr(@NotNull Function<V,R> fun,
R elze) |
R |
getOr(@NotNull Map<V,? extends R> map,
R elze) |
int |
hashCode() |
void |
set(@NotNull BiConsumer<V,R> fun,
R refer) |
void |
set(@NotNull Map<V,? super R> map,
R refer) |
String |
toString() |
R |
tryOr(@NotNull Function<V,?> fun,
R elze) |
R |
tryOr(@NotNull Map<?,?> map,
R elze) |
@NotNull public final V value
public TypedRef(@NotNull
V value)
public void set(@NotNull
@NotNull BiConsumer<V,R> fun,
R refer)
@Contract(value="_,true->!null") public R get(@NotNull @NotNull Function<V,R> fun, boolean nonnull)
@Contract(value="_,true->!null") public R get(@NotNull @NotNull Map<V,? extends R> map, boolean nonnull)
@Contract(value="_,!null ->!null") public R getOr(@NotNull @NotNull Function<V,R> fun, R elze)
@Contract(value="_,!null ->!null") public R getOr(@NotNull @NotNull Map<V,? extends R> map, R elze)
@Contract(value="_,!null ->!null") public R tryOr(@NotNull @NotNull Function<V,?> fun, R elze) throws ClassCastException
ClassCastException@Contract(value="_,!null ->!null") public R tryOr(@NotNull @NotNull Map<?,?> map, R elze) throws ClassCastException
ClassCastExceptionCopyright © 2025. All rights reserved.