org.hibernate.validator.internal.util.annotationfactory

## Class AnnotationDescriptor<T extends Annotation>

- java.lang.Object
- - org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor<T>

-     public class AnnotationDescriptor<T extends Annotation>
      extends Object

  Encapsulates the data you need to create an annotation. In particular, it stores the type of an `Annotation` instance and the values of its elements. The "elements" we're talking about are the annotation attributes, not its targets (the term "element" is used ambiguously in Java's annotations documentation).
  Author:
    Paolo Perrotta, Davide Marchignoli, Hardy Ferentschik, Gunnar Morling

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotationDescriptor(Class<T> annotationType)`
    `AnnotationDescriptor(Class<T> annotationType, Map<String,Object> elements)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsElement(String elementName)`
    `Map<String,Object>` | `getElements()` Returns a map with the elements contained in this descriptor keyed by name.
    `static <S extends Annotation> AnnotationDescriptor<S>` | `getInstance(Class<S> annotationType)` Returns a new descriptor for the given annotation type.
    `static <S extends Annotation> AnnotationDescriptor<S>` | `getInstance(Class<S> annotationType, Map<String,Object> elements)` Returns a new descriptor for the given annotation type.
    `int` | `numberOfElements()`
    `void` | `setValue(String elementName, Object value)`
    `Class<T>` | `type()`
    `Object` | `valueOf(String elementName)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AnnotationDescriptor

          public AnnotationDescriptor(Class<T> annotationType)

    - #### AnnotationDescriptor

          public AnnotationDescriptor(Class<T> annotationType,
                              Map<String,Object> elements)

  - ### Method Detail

    - #### getInstance

          public static <S extends Annotation> AnnotationDescriptor<S> getInstance(Class<S> annotationType)

      Returns a new descriptor for the given annotation type.
      Type Parameters:
        `S` - The type of the annotation.
      Parameters:
        `annotationType` - The annotation's class.
      Returns:
        A new descriptor for the given annotation type.

    - #### getInstance

          public static <S extends Annotation> AnnotationDescriptor<S> getInstance(Class<S> annotationType,
                                                                   Map<String,Object> elements)

      Returns a new descriptor for the given annotation type.
      Type Parameters:
        `S` - The type of the annotation.
      Parameters:
        `annotationType` - The annotation's class.
        `elements` - A map with attribute values for the annotation to be created.
      Returns:
        A new descriptor for the given annotation type.

    - #### setValue

          public void setValue(String elementName,
                      Object value)

    - #### valueOf

          public Object valueOf(String elementName)

    - #### containsElement

          public boolean containsElement(String elementName)

    - #### numberOfElements

          public int numberOfElements()

    - #### getElements

          public Map<String,Object> getElements()

      Returns a map with the elements contained in this descriptor keyed by name. This map is a copy of the internally used map, so it can safely be modified without altering this descriptor.
      Returns:
        A map with this descriptor's elements.

    - #### type

          public Class<T> type()

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved