aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/annotation/Annotation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/bytecode/annotation/Annotation.java')
-rw-r--r--src/main/javassist/bytecode/annotation/Annotation.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/javassist/bytecode/annotation/Annotation.java b/src/main/javassist/bytecode/annotation/Annotation.java
index f4f8ac61..9971fada 100644
--- a/src/main/javassist/bytecode/annotation/Annotation.java
+++ b/src/main/javassist/bytecode/annotation/Annotation.java
@@ -17,6 +17,7 @@ package javassist.bytecode.annotation;
import javassist.bytecode.ConstPool;
import javassist.bytecode.Descriptor;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
@@ -252,7 +253,7 @@ public class Annotation {
* @return null if the member cannot be found or if the value is
* the default value.
*
- * @see AnnotationDefaultAttribute
+ * @see javassist.bytecode.AnnotationDefaultAttribute
*/
public MemberValue getMemberValue(String name) {
if (members == null)
@@ -267,6 +268,22 @@ public class Annotation {
}
/**
+ * Constructs an annotation-type object representing this annotation.
+ * For example, if this annotation represents <code>@Author</code>,
+ * this method returns an <code>Author</code> object.
+ *
+ * @param cl class loader for loading an annotation type.
+ * @param cp class pool for obtaining class files.
+ */
+ public Object toAnnotationType(ClassLoader cl, ClassPool cp)
+ throws ClassNotFoundException
+ {
+ return AnnotationImpl.make(cl,
+ MemberValue.loadClass(cl, getTypeName()),
+ cp, this);
+ }
+
+ /**
* Writes this annotation.
*
* @param writer the output.