|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.predicates.GenericClassPredicate
This Predicate checks to see if the passed object is an instance of the specified class. This class is thread-safe.
Big Fat Note: This class does NOT work in jython, because of the proxy classes prevent Class.isInstance() from working correctly. However, you can create your own using jython's built-in isinstance operator:
class open_predicate(Predicate): def predicate(self, obj): return isinstance(obj, Openable)
Constructor Summary | |
GenericClassPredicate()
Constructs a new GenericClassPredicate with no predicate classes. |
|
GenericClassPredicate(java.lang.Class c)
Constructs a new GenericClassPredicate with the specified class. |
Method Summary | |
void |
addClass(java.lang.Class c)
Adds a class to check for. |
boolean |
predicate(java.lang.Object obj)
Return true if the object is an instance of the class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GenericClassPredicate()
public GenericClassPredicate(java.lang.Class c)
c
- a class for which the predicate will return trueMethod Detail |
public void addClass(java.lang.Class c)
c
- a class to add to the list of classes that pass
the predicate.public boolean predicate(java.lang.Object obj)
predicate
in interface GenericPredicate
obj
- the object to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |