public final class DeferredUtils extends Object
| Constructor and Description |
|---|
DeferredUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<Object> |
flatUnpack(Object deferred) |
static <T> List<T> |
flatUnpackUntil(Object deferred,
BiFunction<Object,Deque<Object>,Boolean> flatter,
UnaryOperator<Object> unpacker,
Class<T> type)
Unpack the specified deferred while flattening until all unpacked values are of the specified type.
|
static <T> List<T> |
flatUnpackUntil(Object deferred,
Class<T> type) |
static <T> List<T> |
flatUnpackUntil(Object deferred,
UnaryOperator<Object> unpacker,
Class<T> type) |
static List<Object> |
flatUnpackWhile(Object deferred,
BiFunction<Object,Deque<Object>,Boolean> flatter,
UnaryOperator<Object> unpacker,
Predicate<Object> predicate) |
static List<Object> |
flatUnpackWhile(Object deferred,
Predicate<Object> predicate) |
static List<Object> |
flatUnpackWhile(Object deferred,
UnaryOperator<Object> unpacker,
Predicate<Object> predicate) |
static <T> void |
realize(DomainObjectCollection<T> collection)
Realize the specified domain object collection.
|
static Object |
unpack(Object deferred)
Successively unpacks a deferred value until it is resolved to null or something other than Callable (including Groovy Closure) or Kotlin lambda or Supplier
then unpacks the remaining Provider or Factory.
|
@Nullable public static Object unpack(@Nullable Object deferred)
public static <T> List<T> flatUnpackUntil(@Nullable Object deferred, UnaryOperator<Object> unpacker, Class<T> type)
public static <T> List<T> flatUnpackUntil(@Nullable Object deferred, BiFunction<Object,Deque<Object>,Boolean> flatter, UnaryOperator<Object> unpacker, Class<T> type)
T - the type to unpackdeferred - the deferred object to unpackflatter - an flatter consumer for the deferred objectunpacker - an unpacker operation for the deferred objecttype - the type to unpackT representing the unpackting of the specified object.
The method returns an empty list if the specified object is null.IllegalArgumentException - if the unpacker operator returns the same objectIllegalStateException - if the flatter consumer removes elements from the queuepublic static List<Object> flatUnpackWhile(@Nullable Object deferred, Predicate<Object> predicate)
public static List<Object> flatUnpackWhile(@Nullable Object deferred, UnaryOperator<Object> unpacker, Predicate<Object> predicate)
public static List<Object> flatUnpackWhile(@Nullable Object deferred, BiFunction<Object,Deque<Object>,Boolean> flatter, UnaryOperator<Object> unpacker, Predicate<Object> predicate)
public static <T> void realize(DomainObjectCollection<T> collection)
T - the type of the collection to realizecollection - the collection to realize