Class FunctorUtils
- java.lang.Object
-
- org.apache.commons.collections4.functors.FunctorUtils
-
class FunctorUtils extends Object
Internal utilities for functors.- Since:
- 3.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <T> Closure<T>coerce(Closure<? super T> closure)A very simple method that coerces Closure super T> to Closure. (package private) static <T> Predicate<T>coerce(Predicate<? super T> predicate)A very simple method that coerces Predicate super T> to Predicate. (package private) static <I,O>
Transformer<I,O>coerce(Transformer<? super I,? extends O> transformer)A very simple method that coerces Transformer super I, ? extends O> to Transformer.(package private) static <E> Closure<E>[]copy(Closure<? super E>... closures)Clone the closures to ensure that the internal reference can't be messed with.(package private) static <T> Predicate<T>[]copy(Predicate<? super T>... predicates)Clone the predicates to ensure that the internal reference can't be messed with.(package private) static <I,O>
Transformer<I,O>[]copy(Transformer<? super I,? extends O>... transformers)Copy method(package private) static <T> Predicate<? super T>[]validate(Collection<? extends Predicate<? super T>> predicates)Validate the predicates to ensure that all is well.(package private) static voidvalidate(Closure<?>... closures)Validate the closures to ensure that all is well.(package private) static voidvalidate(Predicate<?>... predicates)Validate the predicates to ensure that all is well.(package private) static voidvalidate(Transformer<?,?>... transformers)Validate method
-
-
-
Method Detail
-
copy
static <T> Predicate<T>[] copy(Predicate<? super T>... predicates)
Clone the predicates to ensure that the internal reference can't be messed with. Due to thePredicate#evaluate(T)method, Predicate super T> is able to be coerced to Predicatewithout casting issues. - Parameters:
predicates- the predicates to copy- Returns:
- the cloned predicates
-
coerce
static <T> Predicate<T> coerce(Predicate<? super T> predicate)
A very simple method that coerces Predicate super T> to Predicate. Due to the Predicate#evaluate(T)method, Predicate super T> is able to be coerced to Predicatewithout casting issues. This method exists simply as centralised documentation and atomic unchecked warning suppression.
- Type Parameters:
T- the type of object the returned predicate should "accept"- Parameters:
predicate- the predicate to coerce.- Returns:
- the coerced predicate.
-
validate
static void validate(Predicate<?>... predicates)
Validate the predicates to ensure that all is well.- Parameters:
predicates- the predicates to validate
-
validate
static <T> Predicate<? super T>[] validate(Collection<? extends Predicate<? super T>> predicates)
Validate the predicates to ensure that all is well.- Parameters:
predicates- the predicates to validate- Returns:
- predicate array
-
copy
static <E> Closure<E>[] copy(Closure<? super E>... closures)
Clone the closures to ensure that the internal reference can't be messed with.- Parameters:
closures- the closures to copy- Returns:
- the cloned closures
-
validate
static void validate(Closure<?>... closures)
Validate the closures to ensure that all is well.- Parameters:
closures- the closures to validate
-
coerce
static <T> Closure<T> coerce(Closure<? super T> closure)
A very simple method that coerces Closure super T> to Closure. This method exists simply as centralised documentation and atomic unchecked warning suppression.
- Type Parameters:
T- the type of object the returned closure should "accept"- Parameters:
closure- the closure to coerce.- Returns:
- the coerced closure.
-
copy
static <I,O> Transformer<I,O>[] copy(Transformer<? super I,? extends O>... transformers)
Copy method- Parameters:
transformers- the transformers to copy- Returns:
- a clone of the transformers
-
validate
static void validate(Transformer<?,?>... transformers)
Validate method- Parameters:
transformers- the transformers to validate
-
coerce
static <I,O> Transformer<I,O> coerce(Transformer<? super I,? extends O> transformer)
A very simple method that coerces Transformer super I, ? extends O> to Transformer.This method exists simply as centralised documentation and atomic unchecked warning suppression.
- Type Parameters:
I- the type of object the returned transformer should "accept"O- the type of object the returned transformer should "produce"- Parameters:
transformer- the transformer to coerce.- Returns:
- the coerced transformer.
-
-