|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.PropertyConstraint.ByClass
public static class PropertyConstraint.ByClass
ByClass
accepts a property value if it is an
instance of a specific Java class.
new ByClass(String.class)
or
new ByClass(Double)
will ensure
that the property is a String or a Double respecitvely.Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.biojava.bio.PropertyConstraint |
---|
PropertyConstraint.And, PropertyConstraint.ByAnnotationType, PropertyConstraint.ByClass, PropertyConstraint.Enumeration, PropertyConstraint.ExactValue, PropertyConstraint.Or |
Field Summary |
---|
Fields inherited from interface org.biojava.bio.PropertyConstraint |
---|
ANY, NONE |
Constructor Summary | |
---|---|
PropertyConstraint.ByClass(Class cl)
Create a new ByClass instance. |
Method Summary | |
---|---|
boolean |
accept(Object value)
accept returns true if the value fulfills the
constraint. |
Class |
getPropertyClass()
Get the Class used as the constraint. |
boolean |
subConstraintOf(PropertyConstraint subConstraint)
subConstraintOf returns true if the constraint
is a sub-constraint. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PropertyConstraint.ByClass(Class cl)
cl
- the Class that all properties must be assignable toMethod Detail |
---|
public Class getPropertyClass()
public boolean accept(Object value)
PropertyConstraint
accept
returns true if the value fulfills the
constraint.
Manually compare items with the PropertyConstraint. Node:
this will ususaly be done for you in an AnnotationType instance
Use for implementing accept() on AnnotatoinType
accept
in interface PropertyConstraint
value
- an Object
to check.
boolean
.public boolean subConstraintOf(PropertyConstraint subConstraint)
PropertyConstraint
subConstraintOf
returns true if the constraint
is a sub-constraint.
A pair of constraints super and sub are in a superConstraint/subConstraint relationship if every object accepted by sub is also accepted by super. To put it another way, if instanceOf was used as a set-membership indicator function over some set of objects, then the set produced by super would be a superset of that produced by sub.
It is not expected that constraints will neccesarily
maintain references to super/sub types. It will be more usual
to infer this relationship by introspecting the constraints
themselves. For example,
PropertyConstraint.ByClass
will infer
subConstraintOf by looking at the possible class of all items
matching subConstraint.
subConstraintOf
in interface PropertyConstraint
subConstraint
- a PropertyConstraint
to check.
boolean
.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |