001    /*
002     * Licensed under the Apache License, Version 2.0 (the "License");
003     * you may not use this file except in compliance with the License.
004     * You may obtain a copy of the License at
005     *
006     *      http://www.apache.org/licenses/LICENSE-2.0
007     *
008     * Unless required by applicable law or agreed to in writing, software
009     * distributed under the License is distributed on an "AS IS" BASIS,
010     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011     * See the License for the specific language governing permissions and
012     * limitations under the License.
013     */
014    package org.apache.commons.classscan.model;
015    
016    import java.util.Set;
017    
018    import org.apache.commons.classscan.HasName;
019    
020    /**
021     * Metadata about an Annotation
022     */
023    public interface MetaAnnotation extends HasName {
024        /**
025         * Get the name of the Annotation
026         */
027        String getName();
028    
029        /**
030         * Get metadata about the properties of the corresponding Annotation
031         * 
032         * @return The read-only set of properties specified in the annotation
033         */
034        Set<? extends Property> getProperties();
035    
036        /**
037         * Get a single property of the corresponding Annotation
038         * 
039         * @param propertyName
040         *            The name of the Property desired.
041         * @return The Property; or null, if the no Property exists with the given
042         *         name.
043         */
044        Property getProperty(String propertyName);
045    
046        /**
047         * Metadata about an Annotation property
048         */
049        public interface Property extends HasName {
050            /**
051             * Get the property value. This will be
052             * <ul>
053             * <li>a String for String value,</li>
054             * <li>an Object of the wrapper type for primitive values,</li>
055             * <li>an {@link EnumValue} for Enum values,</li>
056             * <li>a MetaAnnotation for Annotations,</li>
057             * <li>an Object[] for any array value</li>
058             * </ul>
059             */
060            Object getValue();
061        }
062    
063        /**
064         * Metadata about an Annotation Enum value
065         */
066        public interface EnumValue {
067            /**
068             * Get information about the Enumeration
069             */
070            MetaClass getEnumType();
071    
072            /**
073             * Get the name of the enumeration instance
074             */
075            String getEnumValue();
076        }
077    }