|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.ChangeType
Class for all constants which are used to indicate change types. Note that all ChangeType objects must be accessible via a public static field of some class or interface. These should be specified at construction time, so that the ChangeType can be properly serialized. Typically, they should be constructed using code like:
class MyClassWhichCanFireChangeEvents { public final static ChangeType CHANGE_COLOR = new ChangeType( "Color change", MyClassWhichCanFireChangeEvents.class, "CHANGE_COLOR"); // Rest of the class here... }
As of BioJava 1.2, the known ChangeTypes of a system follow a simple
hierarchy with single inheritance. All ChangeTypes
(except ChangeType.UNKNOWN) have a parent ChangeType (defaulting
to ChangeType.UNKNOWN). Generally, when a listener is registered
for changetype foo
, changes of type bar
should be accepted if bar
is a sub-type of foo
.
This can be checked using an expression like:
bar.isMatchingType(foo);
Field Summary | |
static ChangeType |
UNKNOWN
Constant ChangeType field which indicates that a change has occured which can't otherwise be represented. |
Constructor Summary | |
ChangeType(java.lang.String name,
java.lang.Class clazz,
java.lang.String fname)
Construct a new ChangeType with supertype UNKNOWN. |
|
ChangeType(java.lang.String name,
java.lang.Class clazz,
java.lang.String fname,
ChangeType superType)
Construct a new ChangeType with supertype UNKNOWN |
|
ChangeType(java.lang.String name,
java.lang.reflect.Field ourField)
Construct a new ChangeType with superType UNKNOWN. |
|
ChangeType(java.lang.String name,
java.lang.reflect.Field ourField,
ChangeType superType)
Construct a new ChangeType. |
|
ChangeType(java.lang.String name,
java.lang.String className,
java.lang.String fieldName)
|
|
ChangeType(java.lang.String name,
java.lang.String className,
java.lang.String fieldName,
ChangeType superType)
|
Method Summary | |
static java.util.Set |
getChangeTypes(java.lang.Class clazz)
Get all ChangeType objects defined within a class. |
java.lang.reflect.Field |
getField()
Return a Field object where this change type is declared. |
java.lang.String |
getName()
Return the name of this change. |
boolean |
isMatchingType(ChangeType ct)
Return true iff ct is equal to this type
or any of it's supertypes (including ChangeType.UNKNOWN). |
java.util.Iterator |
matchingTypes()
Return an iterator which contains this type, and all supertypes. |
java.lang.String |
toString()
Return a string representation of this change. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ChangeType UNKNOWN
As of BioJava 1.2, this type is the root of the ChangeType hierarchy. Listening for this type is equivalent to listening for all ChangeTypes.
Constructor Detail |
public ChangeType(java.lang.String name, java.lang.reflect.Field ourField, ChangeType superType)
name
- The name of this change.ourField
- The public static field which contains this
ChangeType.superType
- The supertype of this type.public ChangeType(java.lang.String name, java.lang.reflect.Field ourField)
name
- The name of this change.ourField
- The public static field which contains this
ChangeType.public ChangeType(java.lang.String name, java.lang.Class clazz, java.lang.String fname)
name
- The name of this change.clazz
- The class which is going to contain this change.fname
- The name of the field in clazz
which
is to contain a reference to this change.
BioError
- If the field cannot be found.public ChangeType(java.lang.String name, java.lang.Class clazz, java.lang.String fname, ChangeType superType)
name
- The name of this change.clazz
- The class which is going to contain this change.fname
- The name of the field in clazz
which
is to contain a reference to this change.superType
- the supertype of this type.
BioError
- If the field cannot be found.public ChangeType(java.lang.String name, java.lang.String className, java.lang.String fieldName, ChangeType superType)
public ChangeType(java.lang.String name, java.lang.String className, java.lang.String fieldName)
Method Detail |
public java.lang.String getName()
public java.lang.reflect.Field getField()
public java.lang.String toString()
public static java.util.Set getChangeTypes(java.lang.Class clazz)
clazz
- A class to introspectpublic java.util.Iterator matchingTypes()
public boolean isMatchingType(ChangeType ct)
true
iff ct
is equal to this type
or any of it's supertypes (including ChangeType.UNKNOWN).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |