Class GroovyClosureFilter<T>

java.lang.Object
de.uplanet.util.filter.GroovyClosureFilter<T>
All Implemented Interfaces:
IFilter<T>

@Scriptable public final class GroovyClosureFilter<T> extends Object implements IFilter<T>
This class implements the IFilter interface as a Groovy closure.
  • Constructor Details

    • GroovyClosureFilter

      public GroovyClosureFilter(groovy.lang.Closure<?> p_closure)
      Create a filter with the given closure.

      Note that this class does not clone the given closure. So the caller is responsible to clone it, if necessary.

      Parameters:
      p_closure - The closure used as a filter.
  • Method Details

    • accept

      public boolean accept(T p_obj)
      Specified by:
      accept in interface IFilter<T>
      Parameters:
      p_obj - The object to be filtered.
      Returns:
      true if this filter accepts the given object, or false otherwise.