PropertyConstraint (BioJava-1.5-beta API)
Keywords: org.biojava.bio.PropertyConstraint 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 PropertyConstraint

All Known Implementing Classes:
  PropertyConstraint.And, PropertyConstraint.ByAnnotationType, PropertyConstraint.ByClass, PropertyConstraint.Enumeration, PropertyConstraint.ExactValue, PropertyConstraint.Or

    public interface PropertyConstraint

`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.

Since:
  1.3
Author:
  Matthew Pocock, Keith James, Thomas Down
For advanced users:
  Instantiate PropertyConstraint classes when populating an AnnotationType instance
For developers:
  Implement PropertyContraint to provide meta-data about a new type of object relationship. For example, if there was a data-structure representing an inheritance hierachy, then an implementation of PropertyConstraint could be written that allowed a propertie's value to be constrained to be a child of a particular node in the hierachy

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(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

### ANY

    static final PropertyConstraint ANY

  `ANY` is a constraint which accepts a property for addition under all conditions.

  For general use:
    Whenever a PropertyConstraint is needed and you want to allow any value there

### NONE

    static final PropertyConstraint NONE

  `NONE` is a constraint which accepts no value for a property under any condition.

  For general use:
    Whenever a PropertyConstraint is needed and you want to dissalow all values there e.g. when marking a property as having to be unset

Method Detail

### accept

    boolean accept(Object value)

  `accept` returns true if the value fulfills the constraint.

  Parameters:
    `value` - an `Object` to check.
  Returns:
    a `boolean`.
  For advanced users:
    Manually compare items with the PropertyConstraint. Node: this will ususaly be done for you in an AnnotationType instance
  For developers:
    Use for implementing accept() on AnnotatoinType

### subConstraintOf

    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.

  Parameters:
    `subConstraint` - a `PropertyConstraint` to check.
  Returns:
    a `boolean`.
  For developers:
    Usefull when attempting to compare two constraints to see if it is necisary to retain both. You may want to check the more general or the more specific constraint only.

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