View Javadoc

1   /*
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    *      http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   * See the License for the specific language governing permissions and
12   * limitations under the License.
13   */
14  package org.apache.commons.classscan.model;
15  
16  import java.util.Set;
17  
18  import org.apache.commons.classscan.HasName;
19  
20  /**
21   * Metadata about an Annotation
22   */
23  public interface MetaAnnotation extends HasName {
24      /**
25       * Get the name of the Annotation
26       */
27      String getName();
28  
29      /**
30       * Get metadata about the properties of the corresponding Annotation
31       * 
32       * @return The read-only set of properties specified in the annotation
33       */
34      Set<? extends Property> getProperties();
35  
36      /**
37       * Get a single property of the corresponding Annotation
38       * 
39       * @param propertyName
40       *            The name of the Property desired.
41       * @return The Property; or null, if the no Property exists with the given
42       *         name.
43       */
44      Property getProperty(String propertyName);
45  
46      /**
47       * Metadata about an Annotation property
48       */
49      public interface Property extends HasName {
50          /**
51           * Get the property value. This will be
52           * <ul>
53           * <li>a String for String value,</li>
54           * <li>an Object of the wrapper type for primitive values,</li>
55           * <li>an {@link EnumValue} for Enum values,</li>
56           * <li>a MetaAnnotation for Annotations,</li>
57           * <li>an Object[] for any array value</li>
58           * </ul>
59           */
60          Object getValue();
61      }
62  
63      /**
64       * Metadata about an Annotation Enum value
65       */
66      public interface EnumValue {
67          /**
68           * Get information about the Enumeration
69           */
70          MetaClass getEnumType();
71  
72          /**
73           * Get the name of the enumeration instance
74           */
75          String getEnumValue();
76      }
77  }