Package com.alibaba.ttl
Class TtlWrappers
- java.lang.Object
-
- com.alibaba.ttl.TtlWrappers
-
public final class TtlWrappers extends Object
Util methods for TTL Wrapper: wrap commonFunctional 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:
TtlRunnable,TtlCallable,TtlUnwrap,TtlWrapper
- all methods is
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T,U>
BiConsumer<T,U>wrap(BiConsumer<T,U> consumer)Deprecated.overload methods using the same namewrapis not readable and have the type inference problems in some case; so usewrapBiConsumer(BiConsumer)instead.static <T,U,R>
BiFunction<T,U,R>wrap(BiFunction<T,U,R> fn)Deprecated.overload methods using the same namewrapis not readable and have the type inference problems in some case; so usewrapBiFunction(BiFunction)instead.static <T> Consumer<T>wrap(Consumer<T> consumer)Deprecated.overload methods using the same namewrapis not readable and have the type inference problems in some case; so usewrapConsumer(java.util.function.Consumer)instead.static <T,R>
Function<T,R>wrap(Function<T,R> fn)Deprecated.overload methods using the same namewrapis not readable and have the type inference problems in some case; so usewrapFunction(Function)instead.static <T> Supplier<T>wrap(Supplier<T> supplier)Deprecated.overload methods using the same namewrapis 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)wrapBiConsumerto TTL wrapper.static <T,U,R>
BiFunction<T,U,R>wrapBiFunction(BiFunction<T,U,R> fn)wrapBiFunctionto TTL wrapper.static <T> Consumer<T>wrapConsumer(Consumer<T> consumer)wrapConsumerto TTL wrapper.static <T,R>
Function<T,R>wrapFunction(Function<T,R> fn)wrapFunctionto TTL wrapper.static <T> Supplier<T>wrapSupplier(Supplier<T> supplier)wrapSupplierto TTL wrapper.
-
-
-
Method Detail
-
wrapSupplier
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Supplier<T> wrapSupplier(@Nullable Supplier<T> supplier)
wrapSupplierto TTL wrapper.- Parameters:
supplier- inputSupplier- Returns:
- Wrapped
Supplier - Since:
- 2.12.4
- See Also:
TtlUnwrap.unwrap(Object)
-
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 namewrapis not readable and have the type inference problems in some case; so usewrapSupplier(Supplier)instead.wrapSupplierto TTL wrapper.- Parameters:
supplier- inputSupplier- Returns:
- Wrapped
Supplier - Since:
- 2.11.4
- See Also:
TtlUnwrap.unwrap(Object)
-
wrapConsumer
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> Consumer<T> wrapConsumer(@Nullable Consumer<T> consumer)
wrapConsumerto TTL wrapper.- Parameters:
consumer- inputConsumer- Returns:
- Wrapped
Consumer - Since:
- 2.12.4
- See Also:
TtlUnwrap.unwrap(Object)
-
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 namewrapis not readable and have the type inference problems in some case; so usewrapConsumer(java.util.function.Consumer)instead.wrapConsumerto TTL wrapper.- Parameters:
consumer- inputConsumer- Returns:
- Wrapped
Consumer - Since:
- 2.11.4
- See Also:
TtlUnwrap.unwrap(Object)
-
wrapBiConsumer
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U> BiConsumer<T,U> wrapBiConsumer(@Nullable BiConsumer<T,U> consumer)
wrapBiConsumerto TTL wrapper.- Parameters:
consumer- inputBiConsumer- Returns:
- Wrapped
BiConsumer - Since:
- 2.12.4
- See Also:
TtlUnwrap.unwrap(Object)
-
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 namewrapis not readable and have the type inference problems in some case; so usewrapBiConsumer(BiConsumer)instead.wrap inputBiConsumerto TTL wrapper.- Parameters:
consumer- inputBiConsumer- Returns:
- Wrapped
BiConsumer - Since:
- 2.11.4
- See Also:
TtlUnwrap.unwrap(Object)
-
wrapFunction
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,R> Function<T,R> wrapFunction(@Nullable Function<T,R> fn)
wrapFunctionto TTL wrapper.- Parameters:
fn- inputFunction- Returns:
- Wrapped
Function - Since:
- 2.12.4
- See Also:
TtlUnwrap.unwrap(Object)
-
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 namewrapis not readable and have the type inference problems in some case; so usewrapFunction(Function)instead.wrapFunctionto TTL wrapper.- Parameters:
fn- inputFunction- Returns:
- Wrapped
Function - Since:
- 2.11.4
- See Also:
TtlUnwrap.unwrap(Object)
-
wrapBiFunction
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U,R> BiFunction<T,U,R> wrapBiFunction(@Nullable BiFunction<T,U,R> fn)
wrapBiFunctionto TTL wrapper.- Parameters:
fn- inputBiFunction- Returns:
- Wrapped
BiFunction - Since:
- 2.12.4
- See Also:
TtlUnwrap.unwrap(Object)
-
wrap
@Deprecated @Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T,U,R> BiFunction<T,U,R> wrap(@Nullable BiFunction<T,U,R> fn)
Deprecated.overload methods using the same namewrapis not readable and have the type inference problems in some case; so usewrapBiFunction(BiFunction)instead.wrapBiFunctionto TTL wrapper.- Parameters:
fn- inputBiFunction- Returns:
- Wrapped
BiFunction - Since:
- 2.11.4
- See Also:
TtlUnwrap.unwrap(Object)
-
-