KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > metadata > spi > MetaData


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.metadata.spi;
23
24 import java.lang.annotation.Annotation JavaDoc;
25
26 /**
27  * MetaData.
28  *
29  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
30  * @version $Revision: 57133 $
31  */

32 public interface MetaData
33 {
34    /** No annotations */
35    Annotation JavaDoc[] NO_ANNOTATIONS = new Annotation JavaDoc[0];
36
37    /** No meta data */
38    Object JavaDoc[] NO_METADATA = new Object JavaDoc[0];
39
40    /**
41     * Get the valid time
42     *
43     * @return the valid time
44     */

45    long getValidTime();
46
47    /**
48     * Get annotation
49     *
50     * @param <T> the annotation type
51     * @param annotationType the annotation type
52     * @return the annotation or null if not present
53     */

54    <T extends Annotation JavaDoc> T getAnnotation(Class JavaDoc<T> annotationType);
55
56    /**
57     * Get all the annotations
58     *
59     * @return the annotations
60     */

61    Annotation JavaDoc[] getAnnotations();
62
63    /**
64     * Get all the local annotations
65     *
66     * @return the annotations
67     */

68    Annotation JavaDoc[] getLocalAnnotations();
69
70    /**
71     * Is the annotation present?
72     *
73     * @param annotationType the annotation type
74     * @return true when present
75     */

76    boolean isAnnotationPresent(Class JavaDoc<? extends Annotation JavaDoc> annotationType);
77
78    /**
79     * Get metadata
80     *
81     * @param <T> the metadata type
82     * @param type the type
83     * @return the metadata or null if not present
84     */

85    <T> T getMetaData(Class JavaDoc<T> type);
86
87    /**
88     * Get all the metadata
89     *
90     * @return the metadata
91     */

92    Object JavaDoc[] getMetaData();
93
94    /**
95     * Get all the local metadata
96     *
97     * @return the metadata
98     */

99    Object JavaDoc[] getLocalMetaData();
100
101    /**
102     * Is the metadata present
103     *
104     * @param type the type of the meta data
105     * @return true when the metadata is present
106     */

107    boolean isMetaDataPresent(Class JavaDoc<?> type);
108
109    /**
110     * Get metadata
111     *
112     * @param name the name of the meta data
113     * @return the metadata or null if not present
114     */

115    Object JavaDoc getMetaData(String JavaDoc name);
116
117    /**
118     * Get metadata
119     *
120     * @param <T> the metadata type
121     * @param name the name of the meta data
122     * @param type the expected type of the metadata
123     * @return the metadata or null if not present
124     */

125    <T> T getMetaData(String JavaDoc name, Class JavaDoc<T> type);
126    
127    /**
128     * Is the metadata present
129     *
130     * @param name the name of the meta data
131     * @return true when the metadata is present
132     */

133    boolean isMetaDataPresent(String JavaDoc name);
134
135    /**
136     * Is the metadata present
137     *
138     * @param name the name of the meta data
139     * @param type the expected type of the metadata
140     * @return true when the metadata is present
141     */

142    boolean isMetaDataPresent(String JavaDoc name, Class JavaDoc<?> type);
143 }
144
Popular Tags