aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/annotation
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-13 16:38:05 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-13 16:38:05 +0000
commit72bc07cd5373defa23c4e66335cb75dd099d9f46 (patch)
treebe1fc8ab81a21b183bae9e03bb72dbc0e35526c3 /src/main/javassist/bytecode/annotation
parent2b3afd3a5dd8dc0e2c4733b10b1661d170356c19 (diff)
downloadjavassist-72bc07cd5373defa23c4e66335cb75dd099d9f46.tar.gz
javassist-72bc07cd5373defa23c4e66335cb75dd099d9f46.zip
Adjusting indentation, adding javadoc comments, etc.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@243 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/annotation')
-rw-r--r--src/main/javassist/bytecode/annotation/AnnotationImpl.java53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/main/javassist/bytecode/annotation/AnnotationImpl.java b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
index 59f83e0d..63d89f9c 100644
--- a/src/main/javassist/bytecode/annotation/AnnotationImpl.java
+++ b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
@@ -24,6 +24,10 @@ import javassist.bytecode.MethodInfo;
import java.lang.reflect.*;
+/**
+ * Internal-use only. This is a helper class internally used for implementing
+ * <code>toAnnotationType()</code> in <code>Annotation</code>.
+ */
public class AnnotationImpl implements InvocationHandler {
private Annotation annotation;
private ClassPool pool;
@@ -50,33 +54,38 @@ public class AnnotationImpl implements InvocationHandler {
classLoader = loader;
}
- public String getTypeName()
- {
- return annotation.getTypeName();
+ /**
+ * Obtains the name of the annotation type.
+ */
+ public String getTypeName() {
+ return annotation.getTypeName();
}
-
+
+ /**
+ * Executes a method invocation on a proxy instance.
+ */
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
- String name = method.getName();
- if (Object.class == method.getDeclaringClass())
- {
- if ("equals".equals(name))
- {
- Object obj = args[0];
- if (obj == null || obj instanceof Proxy == false)
- return Boolean.FALSE;
- Object other = Proxy.getInvocationHandler(obj);
- if (this.equals(other))
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
- if ("toString".equals(name))
- return annotation.getTypeName() + '@' + hashCode();
- if ("hashCode".equals(name))
- return new Integer(hashCode());
+ String name = method.getName();
+ if (Object.class == method.getDeclaringClass()) {
+ if ("equals".equals(name)) {
+ Object obj = args[0];
+ if (obj == null || obj instanceof Proxy == false)
+ return Boolean.FALSE;
+
+ Object other = Proxy.getInvocationHandler(obj);
+ if (this.equals(other))
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+ else if ("toString".equals(name))
+ return annotation.getTypeName() + '@' + hashCode();
+ else if ("hashCode".equals(name))
+ return new Integer(hashCode());
}
+
MemberValue mv = annotation.getMemberValue(name);
if (mv == null)
return getDefault(name, method);