org.biojava.ontology
Class AbstractTerm

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.ontology.AbstractTerm
All Implemented Interfaces:
Annotatable, Term, Changeable
Direct Known Subclasses:
RemoteTerm.Impl, Term.Impl

public abstract class AbstractTerm
extends AbstractChangeable
implements Term

Abstract implementation of term This provides basic change-forwarding functionality from the annotation and ontology properties.

Since:
1.4
Author:
Thomas Down

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.biojava.ontology.Term
Term.Impl
 
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
 
Field Summary
protected  java.lang.String description
           
 
Fields inherited from interface org.biojava.ontology.Term
ONTOLOGY
 
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
 
Constructor Summary
AbstractTerm()
           
 
Method Summary
 ChangeSupport getChangeSupport(ChangeType ct)
          Called to retrieve the ChangeSupport for this object.
 void setDescription(java.lang.String description)
          set the description of the term;
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.ontology.Term
addSynonym, getDescription, getName, getOntology, getSynonyms, removeSynonym
 
Methods inherited from interface org.biojava.bio.Annotatable
getAnnotation
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Field Detail

description

protected java.lang.String description
Constructor Detail

AbstractTerm

public AbstractTerm()
Method Detail

getChangeSupport

public ChangeSupport getChangeSupport(ChangeType ct)
Description copied from class: AbstractChangeable
Called to retrieve the ChangeSupport for this object.

Your implementation of this method should have the following structure:

 ChangeSupport cs = super.getChangeSupport(ct);

 if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
   someForwarder = new ChangeForwarder(...

   this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
 }

 return cs;
 
It is usual for the forwarding listeners (someForwarder in this example) to be transient and lazily instantiated. Be sure to register & unregister the forwarder in the code that does the ChangeEvent handling in setter methods.

Overrides:
getChangeSupport in class AbstractChangeable

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: Term
set the description of the term;

Specified by:
setDescription in interface Term