Package com.alibaba.ttl
Class TtlUnwrap
java.lang.Object
com.alibaba.ttl.TtlUnwrap
Util methods for TTL Wrapper: unwrap TTL Wrapper and check TTL Wrapper.
Note:
all methods are null
-safe, when input parameter is null
, return null
.
Implementation Note:
The util methods in this class should have been inside TtlWrappers
.
But for Java 6
support, it's required splitting the util methods
which involved Java 8
from TtlWrappers
.
In order to avoid loading Java 8
class (eg: Consumer
, Supplier
),
when invoking any methods of TtlWrappers
.
- Since:
- 2.11.4
- Author:
- Jerry Lee (oldratlee at gmail dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> boolean
isWrapper
(T obj) check the input object is aTtlWrapper
or not.static <T> T
unwrap
(T obj) Generic unwrap method, unwrapTtlWrapper
to the original/underneath one.
-
Method Details
-
unwrap
@Nullable @Contract(value="null -> null; !null -> !null", pure=true) public static <T> T unwrap(@Nullable T obj) Generic unwrap method, unwrapTtlWrapper
to the original/underneath one.this method is
null
-safe, when input parameter isnull
, returnnull
; if input parameter is not aTtlWrapper
just return input.- Since:
- 2.11.4
- See Also:
-
TtlRunnable.unwrap(Runnable)
TtlCallable.unwrap(java.util.concurrent.Callable)
TtlExecutors.unwrap(java.util.concurrent.Executor)
TtlExecutors.unwrap(java.util.concurrent.ThreadFactory)
TtlExecutors.unwrap(java.util.Comparator)
TtlForkJoinPoolHelper.unwrap(java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory)
TtlWrappers.wrapSupplier(java.util.function.Supplier)
TtlWrappers.wrapConsumer(java.util.function.Consumer)
TtlWrappers.wrapBiConsumer(java.util.function.BiConsumer)
TtlWrappers.wrapFunction(java.util.function.Function)
TtlWrappers.wrapBiFunction(java.util.function.BiFunction)
isWrapper(Object)
-
isWrapper
check the input object is aTtlWrapper
or not.- Since:
- 2.11.4
- See Also:
-