Class FunctorUtils

java.lang.Object
org.apache.commons.collections4.functors.FunctorUtils

class FunctorUtils extends Object
Internal utilities for functors.
Since:
3.0
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Restricted constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static <T> Closure<T>
    coerce(Closure<? super T> closure)
    A very simple method that coerces Closureinvalid input: '<'? super T> to Closure.
    (package private) static <T> Predicate<T>
    coerce(Predicate<? super T> predicate)
    A very simple method that coerces Predicateinvalid input: '<'? 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 Transformerinvalid input: '<'? super I, ? extends O> to Transformerinvalid input: '<'I, O>.
    (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 void
    validate(Closure<?>... closures)
    Validate the closures to ensure that all is well.
    (package private) static void
    validate(Predicate<?>... predicates)
    Validate the predicates to ensure that all is well.
    (package private) static void
    validate(Transformer<?,?>... transformers)
    Validate method

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FunctorUtils

      private FunctorUtils()
      Restricted constructor.
  • Method Details

    • 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 the
      invalid reference
      Predicate#evaluate(T)
      method, Predicateinvalid input: '<'? super T> is able to be coerced to Predicate without 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 Predicateinvalid input: '<'? super T> to Predicate. Due to the
      invalid reference
      Predicate#evaluate(T)
      method, Predicateinvalid input: '<'? super T> is able to be coerced to Predicate without 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 Closureinvalid input: '<'? 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 Transformerinvalid input: '<'? super I, ? extends O> to Transformerinvalid input: '<'I, O>.

      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.