01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.core.type;
18:
19: import java.util.Map;
20: import java.util.Set;
21:
22: /**
23: * Interface that defines abstract access to the annotations of a specific
24: * class, in a form that does not require that class to be loaded yet.
25: *
26: * @author Juergen Hoeller
27: * @author Mark Fisher
28: * @since 2.5
29: * @see StandardAnnotationMetadata
30: * @see org.springframework.core.type.classreading.MetadataReader#getAnnotationMetadata()
31: */
32: public interface AnnotationMetadata extends ClassMetadata {
33:
34: /**
35: * Return the names of all annotation types defined on the underlying class.
36: * @return the annotation type names
37: */
38: Set<String> getAnnotationTypes();
39:
40: /**
41: * Determine whether the underlying class has an annotation of the given
42: * type defined.
43: * @param annotationType the annotation type to look for
44: * @return whether a matching annotation is defined
45: */
46: boolean hasAnnotation(String annotationType);
47:
48: /**
49: * Return the names of all meta-annotation types defined on the
50: * given annotation type of the underlying class.
51: * @return the meta-annotation type names
52: */
53: Set<String> getMetaAnnotationTypes(String annotationType);
54:
55: /**
56: * Determine whether the underlying class has an annotation that
57: * is itself annotated with the meta-annotation of the given type.
58: * @param metaAnnotationType the meta-annotation type to look for
59: * @return whether a matching meta-annotation is defined
60: */
61: boolean hasMetaAnnotation(String metaAnnotationType);
62:
63: /**
64: * Retrieve the attributes of the annotation of the given type,
65: * if any (i.e. if defined on the underlying class).
66: * @param annotationType the annotation type to look for
67: * @return a Map of attributes, with the attribute name as key
68: * (e.g. "value") and the defined attribute value as Map value.
69: * This return value will be <code>null</code> if no matching
70: * annotation is defined.
71: */
72: Map<String, Object> getAnnotationAttributes(String annotationType);
73:
74: }
|