[webbeans-commits] Webbeans SVN: r135 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Thu Oct 23 18:20:25 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-10-23 18:20:25 -0400 (Thu, 23 Oct 2008)
New Revision: 135
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/AnnotationLiteral.java
Log:
implement equals, hashCode, still need to compare members
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/AnnotationLiteral.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/AnnotationLiteral.java 2008-10-23 21:05:34 UTC (rev 134)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/AnnotationLiteral.java 2008-10-23 22:20:25 UTC (rev 135)
@@ -29,6 +29,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
+// TODO Check members for equals, hashCode and toString()
public abstract class AnnotationLiteral<T extends Annotation> implements
Annotation
{
@@ -102,8 +103,27 @@
@Override
public String toString()
{
- // TODO Make this closer to the spec for Annotation
- String annotationName = "@" + annotationType().getName();
+ String annotationName = "@" + annotationType().getName() + "()";
return annotationName;
}
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof Annotation)
+ {
+ Annotation that = (Annotation) other;
+ return this.annotationType().equals(that.annotationType());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return annotationType().hashCode();
+ }
}
More information about the weld-commits
mailing list