Interface Annotation

All Superinterfaces:
Serializable

public interface Annotation extends Serializable
The common interface extended by all annotation types. An annotation consists of a name (getName()) and a map of attributes getAttribute(java.lang.String).

To get the annotation associated with a component, use ComponentCtrl.getAnnotations(String). To get the annotation associated with a component's property, use ComponentCtrl.getAnnotation(String, String)

Author:
tomyeh
See Also:
  • Method Details

    • getName

      String getName()
      Returns the name of this annotation.

      For each declaration, there is at most one annotation with the same name.

    • getAttributes

      Map<String,String[]> getAttributes()
      Returns the map of attributes(never null). The key is a String instance, while the value is an array of String instances (length might be zero, but it is never null).

      The returned map is read-only.

    • getAttribute

      String getAttribute(String name)
      Returns the first value of the given attribute, or null if not found. By the first value we mean the first element in the value array.
    • getAttributeValues

      String[] getAttributeValues(String name)
      Returns all values of the given attribute, or null if not found. Notice if the attribute is assigned with no value, a zero-length array is returned.
      Since:
      6.0.0
    • getLocation

      Location getLocation()
      Returns the location information of the annotation in the document, or null if not available. It is useful for displaying the error message:
      
      private static String message(String message, Location loc) {
         return loc != null ? loc.format(message): message;
      }
      Since:
      6.0.0