|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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;
}
}
| 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 |
public static final ChangeType ANNOTATION
| Method Detail |
public Annotation getAnnotation()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||