## org.biojava.bio
Class AnnotationType.Impl

    java.lang.Object
      org.biojava.bio.AnnotationType.Abstract
          org.biojava.bio.AnnotationType.Impl

All Implemented Interfaces:
  AnnotationType

Enclosing class:
  AnnotationType

public static class AnnotationType.Impl
extends AnnotationType.Abstract

An implementation of `AnnotationType`.

To build an instance of `AnnotationType.Impl`, first invoke the no-args constructor, and then use the setPropertyConstraint method to build the property->constraint mapping.

Since:
  1.3
Author:
  Matthew Pocock, Thomas Down
For advanced users:
  A convenient class for when you need an AnnotationType instance and don't want to write your own

Nested Class Summary

Nested classes inherited from class org.biojava.bio.AnnotationType
`AnnotationType.Abstract, AnnotationType.Impl`

Field Summary

Fields inherited from interface org.biojava.bio.AnnotationType
`ANY, NONE`

Constructor Summary
`AnnotationType.Impl()` Create a new Impl with no constraints.
`AnnotationType.Impl(CollectionConstraint unknown)` Create a new Impl with a default collection constraint.
`AnnotationType.Impl(PropertyConstraint defaultPC, Location defaultCC)` Create a new Impl with a default property and cardinality constraint.

Method Summary
`java.lang.String` `getComment()` Get the comment for the whole AnnotationType.
`java.lang.String` `getComment(java.lang.Object key)` Get the comment for a particular property.
`CollectionConstraint` `getConstraint(java.lang.Object key)` Retrieve the constraint that will be applied to all properties with a given key.
`CollectionConstraint` `getDefaultConstraint()` Get the CollectionConstraint that will be applied to all properties without an explicit binding.
`java.util.Set` `getProperties()` Retrieve the set of properties for which constraints have been explicity specified.
`void` `setComment(java.lang.Object key, java.lang.String comment)` Set the comment for a particular property.
`void` `setComment(java.lang.String comment)` Set the comment for the whole AnnotationType.
`void` `setConstraint(java.lang.Object key, CollectionConstraint cc)` Specifies the constraint to apply to the specified property.
`void` `setDefaultConstraint(CollectionConstraint cc)` Specifies the default constraint to apply to properties where no other constraint is specified.

Methods inherited from class org.biojava.bio.AnnotationType.Abstract
`addProperty, getProperty, instanceOf, removeProperty, setConstraints, setDefaultConstraints, setProperty, subTypeOf, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AnnotationType.Impl

    public AnnotationType.Impl()

  Create a new Impl with no constraints.

### AnnotationType.Impl

    public AnnotationType.Impl(PropertyConstraint defaultPC,
                               Location defaultCC)

  Create a new Impl with a default property and cardinality constraint.

Parameters:
  `defaultPC` - the default PropertyConstraint
  `defaultCC` - the default CardinalityConstraint

### AnnotationType.Impl

    public AnnotationType.Impl(CollectionConstraint unknown)

  Create a new Impl with a default collection constraint.

Method Detail

### setDefaultConstraint

    public void setDefaultConstraint(CollectionConstraint cc)

  Description copied from interface: `AnnotationType`
  Specifies the default constraint to apply to properties where no other constraint is specified.

  Parameters:
    `cc` - The default constraint.

### getDefaultConstraint

    public CollectionConstraint getDefaultConstraint()

  Description copied from interface: `AnnotationType`
  Get the CollectionConstraint that will be applied to all properties without an explicit binding. This defaults to CollectionConstraint.ALL.

  Returns:
    the default CollectionConstraint

### getConstraint

    public CollectionConstraint getConstraint(java.lang.Object key)

  Description copied from interface: `AnnotationType`

  Retrieve the constraint that will be applied to all properties with a given key.

  For an `Annotation` to be accepted, each key in getProperties() must be present in the annotation and each of the values associated with those properties must match the constraint.

  Parameters:
    `key` - the property to be validated.
  Returns:
    PropertyConstraint the constraint by which the values must be accepted.

### setConstraint

    public void setConstraint(java.lang.Object key,
                              CollectionConstraint cc)

  Description copied from interface: `AnnotationType`
  Specifies the constraint to apply to the specified property.

  Parameters:
    `key` - the name of the property to constrain
    `cc` - the constraint to apply to this slot.

### getProperties

    public java.util.Set getProperties()

  Description copied from interface: `AnnotationType`
  Retrieve the set of properties for which constraints have been explicity specified.

  Returns:
    the Set of properties to validate.

### setComment

    public void setComment(java.lang.String comment)

  Description copied from interface: `AnnotationType`
  Set the comment for the whole AnnotationType. This is human-readable text.

  Parameters:
    `comment` - the new comment

### getComment

    public java.lang.String getComment()

  Description copied from interface: `AnnotationType`
  Get the comment for the whole AnnotationType. This is human-readable text.

  Returns:
    the comment

### setComment

    public void setComment(java.lang.Object key,
                           java.lang.String comment)

  Description copied from interface: `AnnotationType`
  Set the comment for a particular property. This is a human-readable description of the property.

  Parameters:
    `key` - the property to comment on
    `comment` - the comment

### getComment

    public java.lang.String getComment(java.lang.Object key)

  Description copied from interface: `AnnotationType`
  Get the comment for a particular property. This is a human-readable description of the property.

  Parameters:
    `key` - the property to get a comment for