Class SimpleAnnotation

  • All Implemented Interfaces:
    java.io.Serializable, Annotation, Changeable

    public class SimpleAnnotation
    extends AbstractAnnotation

    A no-frills implementation of Annotation that is just a wrapper around a LinkedHashMap.

    It will allow you to set any property, but will throw exceptions if you try to retrieve a property that is not set. Because of the use of a LinkedHashMap properties are iterated in the order they are entered.

    When you need to make a new Annotation instance and will want to populate it with properties, use this class.
    Since:
    1.0
    Author:
    Matthew Pocock, Greg Cox, Mark Schreiber
    See Also:
    SimpleRichAnnotation, Serialized Form
    • Constructor Detail

      • SimpleAnnotation

        public SimpleAnnotation()
        Create a new, empty SimpleAnnotation instance.
      • SimpleAnnotation

        public SimpleAnnotation​(Annotation ann)
        Create a new SimpleAnnotation by copying the properties from another one. The new Annotation instance will be independant of the original.
        Parameters:
        ann - the Annotation to copy
      • SimpleAnnotation

        public SimpleAnnotation​(java.util.Map map)
        Create a new SimpleAnnotation using the values in a Map.
        Parameters:
        map - the Map to copy properties out of
    • Method Detail

      • getProperties

        protected final java.util.Map getProperties()
        Get the property value pairs in this annotation
        Specified by:
        getProperties in class AbstractAnnotation
        Returns:
        a LinkedHashMap of properties and values
      • propertiesAllocated

        protected final boolean propertiesAllocated()
        Test to see if any properties have been allocated
        Specified by:
        propertiesAllocated in class AbstractAnnotation
        Returns:
        true if any have (even if they have since been removed), false otherwise