public final class ChangeType extends Object implements Serializable
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);
Modifier and Type | Field and Description |
---|---|
static ChangeType |
UNKNOWN
Constant ChangeType field which indicates that a change has
occured which can't otherwise be represented.
|
Constructor and Description |
---|
ChangeType(String name,
Class clazz,
String fname)
Construct a new ChangeType with supertype UNKNOWN.
|
ChangeType(String name,
Class clazz,
String fname,
ChangeType superType)
Construct a new ChangeType.
|
ChangeType(String name,
Field ourField)
Construct a new ChangeType with superType UNKNOWN.
|
ChangeType(String name,
Field ourField,
ChangeType superType)
Construct a new ChangeType.
|
ChangeType(String name,
String className,
String fieldName) |
ChangeType(String name,
String className,
String fieldName,
ChangeType superType) |
Modifier and Type | Method and Description |
---|---|
static Set |
getChangeTypes(Class clazz)
Get all ChangeType objects defined within a class.
|
Field |
getField()
Return a Field object where this change type is declared.
|
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). |
Iterator |
matchingTypes()
Return an iterator which contains this type, and all supertypes.
|
String |
toString()
Return a string representation of this change.
|
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.
public ChangeType(String name, 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(String name, Field ourField)
name
- The name of this change.ourField
- The public static field which contains this
ChangeType.public ChangeType(String name, Class clazz, 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(String name, Class clazz, 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(String name, String className, String fieldName, ChangeType superType)
public ChangeType(String name, String className, String fieldName)
public static Set getChangeTypes(Class clazz)
clazz
- A class to introspectpublic Iterator matchingTypes()
public boolean isMatchingType(ChangeType ct)
true
iff ct
is equal to this type
or any of it's supertypes (including ChangeType.UNKNOWN). If this is
true, then ct is more general than this.Copyright © 2014 BioJava. All rights reserved.