public abstract static class AnnotationType.Abstract extends Object implements AnnotationType
An abstract base class useful for implementing AnnotationType instances.
This provides deffinitions for the logical operators (validate(), subTypeOf()), the mutators (setProperty(), getProperty() and deleteProperty()) and toString() that you may not want to write yourself. It leaves the data-related methods up to you.
AnnotationType.Abstract, AnnotationType.ImplANY, NONE| Constructor and Description |
|---|
Abstract() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(Annotation ann,
Object key,
Object value)
Add a value to the specified property slot.
|
Collection |
getProperty(Annotation ann,
Object property)
Get the Collection of values associated with an Annotation bundle
according to the type we believe it to be.
|
boolean |
instanceOf(Annotation ann)
Validate an Annotation against this AnnotationType.
|
void |
removeProperty(Annotation ann,
Object key,
Object value)
Remove a value from the specified property slot.
|
void |
setConstraints(Object key,
PropertyConstraint pc,
Location cc)
Set the constraints associated with a property.
|
void |
setDefaultConstraints(PropertyConstraint pc,
Location cc)
Set the constraints that will apply to all properties without an
explicitly defined set of constraints.
|
void |
setProperty(Annotation ann,
Object property,
Object value)
Set the property in an annotation bundle according to the type we believe
it should be.
|
boolean |
subTypeOf(AnnotationType subType)
See if an AnnotationType is a specialisation of this type.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComment, getComment, getConstraint, getDefaultConstraint, getProperties, setComment, setComment, setConstraint, setDefaultConstraintpublic Abstract()
public void setConstraints(Object key, PropertyConstraint pc, Location cc)
AnnotationTypecon, and the number of members must match card.
It implicitly constructs a CollectionConstraint.AllValuesIn
instance.
When you are building your own AnnotationType
setConstraints in interface AnnotationTypekey - the name of the property to constrainpc - the PropertyConstraint to enforcecc - the CardinalityConstraint to enforcepublic void setDefaultConstraints(PropertyConstraint pc, Location cc)
AnnotationTypecon, and the number of members must match card.
It implicitly constructs a CollectionConstraint.AllValuesIn
instance.setDefaultConstraints in interface AnnotationTypepc - the default PropertyConstraintcc - the default CardinalityConstraintpublic boolean instanceOf(Annotation ann)
AnnotationTypeinstanceOf in interface AnnotationTypeann - the Annotation to validate.public final void setProperty(Annotation ann, Object property, Object value) throws ChangeVetoException
AnnotationTypesetProperty in interface AnnotationTypeann - the Annotation to modifyproperty - the property key Objectvalue - the property value ObjectChangeVetoException - if the value could not be accepted by this
annotation type for that property key, or if the Annotation could
not be modifiedpublic final Collection getProperty(Annotation ann, Object property) throws ChangeVetoException
AnnotationTypegetProperty in interface AnnotationTypeann - the Annotation to accessproperty - the property key ObjectChangeVetoException - if the value could not be removedpublic final void addProperty(Annotation ann, Object key, Object value) throws ChangeVetoException
AnnotationTypeaddProperty in interface AnnotationTypeann - the Annotation to modifykey - the property key Objectvalue - the property value ObjectChangeVetoException - if the value could not be accepted by this
annotation type for that property key, or if the Annotation could
not be modifiedpublic final void removeProperty(Annotation ann, Object key, Object value) throws ChangeVetoException
AnnotationTyperemoveProperty in interface AnnotationTypeann - the Annotation to modifykey - the property key Objectvalue - the property value ObjectChangeVetoException - if the Annotation could
not be modifiedpublic boolean subTypeOf(AnnotationType subType)
AnnotationTypeSee if an AnnotationType is a specialisation of this type.
An AnnotationType is a sub-type if it restricts each of the properties of the super-type to a type that can be cast to the type in the super-type. Note that this is not always a cast in the pure Java sense; it may include checks on the number and type of members in collections or other criteria.
subTypeOf in interface AnnotationTypesubType - an AnnotationType to check.Copyright © 2020 BioJava. All rights reserved.