Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.utils
Class ChangeType

    java.lang.Object
      org.biojava.utils.ChangeType

All Implemented Interfaces:
  Serializable

    public final class ChangeType

extends Object
implements Serializable

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);

Since:
  1.1
Author:
  Thomas Down, Matthew Pocock
See Also:
  Serialized Form

Field Summary
`static ChangeType` | `UNKNOWN` Constant ChangeType field which indicates that a change has occured which can't otherwise be represented.

Constructor Summary
`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)`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### UNKNOWN

    public static final ChangeType UNKNOWN

  Constant ChangeType field which indicates that a change has occured which can't otherwise be represented. Please do not use this when there is another, more sensible, option. This is the fallback for when you realy don't know what else to do.

  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

### ChangeType

    public ChangeType(String name,
                      Field ourField,
                      ChangeType superType)

  Construct a new ChangeType.

  Parameters:
    `name` - The name of this change.
    `ourField` - The public static field which contains this ChangeType.
    `superType` - The supertype of this type.
  Since:
    1.2

### ChangeType

    public ChangeType(String name,
                      Field ourField)

  Construct a new ChangeType with superType UNKNOWN.

  Parameters:
    `name` - The name of this change.
    `ourField` - The public static field which contains this ChangeType.

### ChangeType

    public ChangeType(String name,
                      Class clazz,
                      String fname)

  Construct a new ChangeType with supertype UNKNOWN.

  Parameters:
    `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.
  Throws:
    `BioError` - If the field cannot be found.

### ChangeType

    public ChangeType(String name,
                      Class clazz,
                      String fname,
                      ChangeType superType)

  Construct a new ChangeType.

  Parameters:
    `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.
  Throws:
    `BioError` - If the field cannot be found.
  Since:
    1.2

### ChangeType

    public ChangeType(String name,
                      String className,
                      String fieldName,
                      ChangeType superType)

### ChangeType

    public ChangeType(String name,
                      String className,
                      String fieldName)

Method Detail

### getName

    public String getName()

  Return the name of this change.

  Returns:
    The Name value

### getField

    public Field getField()

  Return a Field object where this change type is declared.

### toString

    public String toString()

  Return a string representation of this change.

  Overrides:
    `toString` in class `Object`
  Returns:
    Description of the Returned Value

### getChangeTypes

    public static Set getChangeTypes(Class clazz)

  Get all ChangeType objects defined within a class. This includes ChangeTypes defined in superclasses and interfaces. Only fields declared as public [final] static ChangeType are returned.

  Parameters:
    `clazz` - A class to introspect

### matchingTypes

    public Iterator matchingTypes()

  Return an iterator which contains this type, and all supertypes.

  Since:
    1.2

### isMatchingType

    public boolean isMatchingType(ChangeType ct)

  Return `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.

  Since:
    1.2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD