Package com.alibaba.ttl
Class TtlWrappers
java.lang.Object
com.alibaba.ttl.TtlWrappers
Util methods for TTL Wrapper: wrap common
Functional Interface
.
Note:
- all methods is
null
-safe, when input parameter isnull
, returnnull
. - all wrap method skip wrap (aka. just return input parameter), when input parameter is already wrapped.
- Since:
- 2.11.4
- Author:
- Jerry Lee (oldratlee at gmail dot com), huangfei1101 (fei.hf at alibaba-inc dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
U> BiConsumer<T, U> wrap
(BiConsumer<T, U> consumer) Deprecated.static <T,
U, R> BiFunction<T, U, R> wrap
(BiFunction<T, U, R> fn) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapBiFunction(BiFunction)
instead.static <T> Consumer<T>
Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapConsumer(java.util.function.Consumer)
instead.static <T,
R> Function<T, R> Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapFunction(Function)
instead.static <T> Supplier<T>
Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapSupplier(Supplier)
instead.static <T,
U> BiConsumer<T, U> wrapBiConsumer
(BiConsumer<T, U> consumer) wrapBiConsumer
to TTL wrapper.static <T,
U, R> BiFunction<T, U, R> wrapBiFunction
(BiFunction<T, U, R> fn) wrapBiFunction
to TTL wrapper.static <T> Consumer<T>
wrapConsumer
(Consumer<T> consumer) wrapConsumer
to TTL wrapper.static <T,
R> Function<T, R> wrapFunction
(Function<T, R> fn) wrapFunction
to TTL wrapper.static <T> Supplier<T>
wrapSupplier
(Supplier<T> supplier) wrapSupplier
to TTL wrapper.
-
Method Details
-
wrapSupplier
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Supplier<T> wrapSupplier(@Nullable Supplier<T> supplier) wrapSupplier
to TTL wrapper. -
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Supplier<T> wrap(@Nullable Supplier<T> supplier) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapSupplier(Supplier)
instead.wrapSupplier
to TTL wrapper. -
wrapConsumer
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Consumer<T> wrapConsumer(@Nullable Consumer<T> consumer) wrapConsumer
to TTL wrapper. -
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Consumer<T> wrap(@Nullable Consumer<T> consumer) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapConsumer(java.util.function.Consumer)
instead.wrapConsumer
to TTL wrapper. -
wrapBiConsumer
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U> BiConsumer<T,U> wrapBiConsumer(@Nullable BiConsumer<T, U> consumer) wrapBiConsumer
to TTL wrapper.- Parameters:
consumer
- inputBiConsumer
- Returns:
- Wrapped
BiConsumer
- Since:
- 2.12.4
- See Also:
-
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U> BiConsumer<T,U> wrap(@Nullable BiConsumer<T, U> consumer) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapBiConsumer(BiConsumer)
instead.wrap inputBiConsumer
to TTL wrapper.- Parameters:
consumer
- inputBiConsumer
- Returns:
- Wrapped
BiConsumer
- Since:
- 2.11.4
- See Also:
-
wrapFunction
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,R> Function<T,R> wrapFunction(@Nullable Function<T, R> fn) wrapFunction
to TTL wrapper. -
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,R> Function<T,R> wrap(@Nullable Function<T, R> fn) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapFunction(Function)
instead.wrapFunction
to TTL wrapper. -
wrapBiFunction
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U, BiFunction<T,R> U, wrapBiFunctionR> (@Nullable BiFunction<T, U, R> fn) wrapBiFunction
to TTL wrapper.- Parameters:
fn
- inputBiFunction
- Returns:
- Wrapped
BiFunction
- Since:
- 2.12.4
- See Also:
-
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U, BiFunction<T,R> U, wrapR> (@Nullable BiFunction<T, U, R> fn) Deprecated.overload methods using the same namewrap
is not readable and have the type inference problems in some case; so usewrapBiFunction(BiFunction)
instead.wrapBiFunction
to TTL wrapper.- Parameters:
fn
- inputBiFunction
- Returns:
- Wrapped
BiFunction
- Since:
- 2.11.4
- See Also:
-
wrap
is not readable and have the type inference problems in some case; so usewrapBiConsumer(BiConsumer)
instead.