net.sf.jga.fn.property
Class InstanceOf<T>
java.lang.Object
net.sf.jga.fn.UnaryFunctor<T,java.lang.Boolean>
net.sf.jga.fn.UnaryPredicate<T>
net.sf.jga.fn.property.InstanceOf<T>
- All Implemented Interfaces:
- java.io.Serializable, Visitable
public class InstanceOf<T>
- extends UnaryPredicate<T>
Functor that returns true if the argument is of the given subtype of T.
Copyright © 2004 David A. Hall
- Author:
- David A. Hall
- See Also:
- Serialized Form
|
Nested Class Summary |
static interface |
InstanceOf.Visitor
Interface for classes that may interpret a InstanceOf
function. |
|
Constructor Summary |
InstanceOf(java.lang.Class<? extends T> cl)
Builds a InstanceOf predicate that tests against the given class. |
|
Method Summary |
void |
accept(Visitor v)
Calls the Visitor's visit(InstanceOf) method, if it
implements the nested Visitor interface. |
java.lang.Boolean |
fn(T arg)
Executes the function and returns the result. |
java.lang.Class<? extends T> |
getTestClass()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
InstanceOf
public InstanceOf(java.lang.Class<? extends T> cl)
- Builds a InstanceOf predicate that tests against the given class.
- Throws:
java.lang.IllegalArgumentException - if the class is null.
getTestClass
public java.lang.Class<? extends T> getTestClass()
fn
public java.lang.Boolean fn(T arg)
- Description copied from class:
UnaryFunctor
- Executes the function and returns the result.
- Specified by:
fn in class UnaryFunctor<T,java.lang.Boolean>
accept
public void accept(Visitor v)
- Calls the Visitor's
visit(InstanceOf) method, if it
implements the nested Visitor interface.
- Specified by:
accept in interface Visitable- Overrides:
accept in class UnaryFunctor<T,java.lang.Boolean>
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
Copyright © 2002-2005 David A. Hall. All Rights Reserved.