|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PropertyConstraint
s describes a constraint applied
to the members of an annotation bundle.
PropertyConstraint
s are usually used in conjunction
with the AnnotationType
interface to describe a class
of annotations by the values of their properties. In this way, you
can generate controlled vocabularies over Java objects.
The constraints accept or reject individual objects. In general, it is not possible to get back a set of all items that would be accepted by a particular constraint.
Nested Class Summary | |
static class |
PropertyConstraint.And
A property constraint that accpepts items iff they are accepted by both child constraints. |
static class |
PropertyConstraint.ByAnnotationType
ByAnnotationType accepts a property value if it
belongs to type defined by AnnotationType. |
static class |
PropertyConstraint.ByClass
ByClass accepts a property value if it is an
instance of a specific Java class. |
static class |
PropertyConstraint.Enumeration
Enumeration accepts a property if it is present
in the specified set of values. |
static class |
PropertyConstraint.ExactValue
Matches properties if they have exactly this one value. |
static class |
PropertyConstraint.Or
A property constraint that accepts items iff they are accepted by either child constraints. |
Field Summary | |
static PropertyConstraint |
ANY
ANY is a constraint which accepts a property for
addition under all conditions. |
static PropertyConstraint |
NONE
NONE is a constraint which accepts no value for a property
under any condition. |
Method Summary | |
boolean |
accept(java.lang.Object value)
accept returns true if the value fulfills the
constraint. |
boolean |
subConstraintOf(PropertyConstraint subConstraint)
subConstraintOf returns true if the constraint
is a sub-constraint. |
Field Detail |
public static final PropertyConstraint ANY
ANY
is a constraint which accepts a property for
addition under all conditions.
public static final PropertyConstraint NONE
NONE
is a constraint which accepts no value for a property
under any condition.
Method Detail |
public boolean accept(java.lang.Object value)
accept
returns true if the value fulfills the
constraint.
value
- an Object
to check.
boolean
.public boolean subConstraintOf(PropertyConstraint subConstraint)
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.
subConstraint
- a PropertyConstraint
to check.
boolean
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |