Annotatable (BioJava-1.5-beta API)
Keywords: org.biojava.bio.Annotatable interface

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.bio
Interface Annotatable

All Superinterfaces:
  Changeable

All Known Subinterfaces:
  Alphabet, AtomicSymbol, BasisSymbol, BioEntry, ComparableTerm, ComparableTriple, ComponentFeature, CrossRef, DotState, EmissionState, Feature, FeatureTypes.Repository, FeatureTypes.Type, FiniteAlphabet, FramedFeature, GappedSequence, GFF3Record, HomologyFeature, ModelInState, OntologyTerm, RemoteFeature, RemoteTerm, RestrictionSite, RichAnnotatable, RichFeature, RichLocation, RichSequence, SeqSimilaritySearchHit, SeqSimilaritySearchResult, SeqSimilaritySearchSubHit, Sequence, SimilarityPairFeature, State, StrandedFeature, Symbol, SymbolTokenization, Taxon, Term, Triple, UnigeneCluster, Variable

All Known Implementing Classes:
  AbstractAlphabet, AbstractSymbol, AbstractTaxon, AbstractTerm, CharacterTokenization, CircularView, CompoundRichLocation, CrossProductTokenization, DoubleAlphabet, DoubleAlphabet.DoubleRange, DoubleAlphabet.DoubleSymbol, DoubleAlphabet.SubDoubleAlphabet, DoubleTokenization, DummySequence, EmptyRichLocation, FeatureTypes.RepositoryImpl, FundamentalAtomicSymbol, GFF3Record.Impl, IntegerAlphabet, IntegerAlphabet.IntegerSymbol, IntegerAlphabet.SubIntegerAlphabet, IntegerOntology.IntTerm, IntegerTokenization, MagicalState, MultiSourceCompoundRichLocation, NameTokenization, NewSimpleAssembly, OntologyTerm.Impl, PhredSequence, ProfileEmissionState, ProjectedFeature, RemoteTerm.Impl, RevCompSequence, SequenceDBSearchHit, SequenceDBSearchResult, SequenceDBSearchSubHit, SimpleAlphabet, SimpleAssembly, SimpleAtomicSymbol, SimpleBioEntry, SimpleComparableTerm, SimpleComparableTriple, SimpleCrossRef, SimpleDotState, SimpleEmissionState, SimpleFeature, SimpleFramedFeature, SimpleGappedSequence, SimpleHomologyFeature, SimpleModelInState, SimpleRemoteFeature, SimpleRestrictionSite, SimpleRichFeature, SimpleRichLocation, SimpleRichSequence, SimpleSeqSimilaritySearchHit, SimpleSeqSimilaritySearchResult, SimpleSeqSimilaritySearchSubHit, SimpleSequence, SimpleSimilarityPairFeature, SimpleStrandedFeature, SimpleTaxon, SingletonAlphabet, SoftMaskedAlphabet, SoftMaskedAlphabet.CaseSensitiveTokenization, SubIntegerTokenization, SubSequence, Term.Impl, ThinRichSequence, Triple.Impl, Variable.Impl, ViewSequence, WeakTaxon, WordTokenization

    public interface Annotatable

extends Changeable

Indicates that an object has an associated annotation.

Many BioJava objects will have associated unstructured data. This should be stored in an Annotation instance. However, the BioJava object itself will probably not want to extend the Annotation interface directly, but rather delegate off that functionality to an Annotation property. The Annotatable interface indicates that there is an Annotation property. When implementing Annotatable, you should always create a protected or private field containing an instance of ChangeForwarder, and register it as a ChangeListener with the associated Annotation delegate instance.

     public class Foo extends AbstractChangeable implements Annotatable {
       private Annotation ann; // the associated annotation delegate
       protected ChangeForwarder annFor; // the event forwarder

       public Foo() {
         // make the ann delegate
         ann = new SimpleAnnotation();
         // construct the forwarder so that it emits Annotatable.ANNOTATION ChangeEvents
         // for the Annotation.PROPERTY events it will listen for
         annFor = new ChangeForwarder.Retyper(this, getChangesupport( Annotatable.ANNOTATION ),
                                              Annotatable.ANNOTATION );
         // connect the forwarder so it listens for Annotation.PROPERTY events
         ann.addChangeListener( annFor, Annotation.PROPERTY );
       }

       public Annotation getAnnotation() {
         return ann;
       }
     }

Since:
  1.0
Author:
  Matthew Pocock, Keith James (docs)., Kalle N�slund (docs)
See Also:
  `RichAnnotatable`
For general use:
  Check if BioJava classes and interfaces extend Annotatable. This will tell you if you should look for associated annotation.
For advanced users:
  If an object implements Annotatable, it may well propagate ChangeEvent notifications from the associated Annotation. You may need to track these to maintain the state of your applications.
For developers:
  Be careful to hook up the appropriate event forwarders.
  The getAnnotation() method can be implemented lazily (instantiate the Annotation instance and event forwarders when the first request comes in). It can also be implemented by returning throw-away immutable Annotation instances that are built from scratch each time.

Nested Class Summary
`static class` | `Annotatable.AnnotationForwarder` Deprecated. use `new ChangeForwarder.Retyper(source, cs, Annotation.PROPERTY)` instead

Field Summary
`static ChangeType` | `ANNOTATION` Signals that the associated Annotation has altered in some way.

Method Summary
`Annotation` | `getAnnotation()` Should return the associated annotation object.

Methods inherited from interface org.biojava.utils.Changeable
`addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener`

Field Detail

### ANNOTATION

    static final ChangeType ANNOTATION

  Signals that the associated Annotation has altered in some way. The chainedEvent property should refer back to the event fired by the Annotation object.

Method Detail

### getAnnotation

    Annotation getAnnotation()

  Should return the associated annotation object.

  Returns:
    an Annotation object, never null

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