[webbeans-commits] Webbeans SVN: r1134 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Jan 20 18:32:59 EST 2009
Author: pete.muir at jboss.org
Date: 2009-01-20 18:32:58 -0500 (Tue, 20 Jan 2009)
New Revision: 1134
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedParameter.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedType.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotationStore.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java
Log:
More realiziation fixes
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -20,14 +20,9 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Set;
-import javax.webbeans.BindingType;
-
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Types;
@@ -46,7 +41,7 @@
*
* @see org.jboss.webbeans.introspector.AnnotatedItem
*/
-public abstract class AbstractAnnotatedItem<T, S> implements WrappableAnnotatedItem<T, S>
+public abstract class AbstractAnnotatedItem<T, S> implements AnnotatedItem<T, S>
{
interface WrappableAnnotatedItem<T, S> extends AnnotatedItem<T, S>
@@ -56,11 +51,8 @@
}
- // The array of default binding types
- private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentLiteral() };
- // The set of default binding types
- private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
// Cached string representation
private String toString;
private final AnnotationStore annotationStore;
@@ -84,67 +76,29 @@
return annotationStore;
}
- /**
- * Gets the annotation for a given annotation type.
- *
- * @param annotationType the annotation type to match
- * @return The annotation if found, null if no match was found
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getAnnotation(Class)
- */
public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
{
- return annotationType.cast(getAnnotationStore().getAnnotationMap().get(annotationType));
+ return getAnnotationStore().getAnnotation(annotationType);
}
- /**
- * Gets the set of annotations that contain a given annotation type
- *
- * @param metaAnnotationType The meta-annotation type to match
- * @return The set of annotations containing this meta-annotation. An empty
- * set is returned if no match is found.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getMetaAnnotations(Class)
- */
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableSet(getAnnotationStore().getMetaAnnotationMap().get(metaAnnotationType));
+ return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
}
public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableSet(getAnnotationStore().getDeclaredMetaAnnotationMap().get(metaAnnotationType));
+ return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
}
- /**
- * Gets (as an array) the set of annotations that contain a given annotation
- * type.
- *
- * Populates the annotationArray if it was null
- *
- * @param metaAnnotationType meta-annotation type to match
- * @return The array of annotations to match. An empty array is returned if
- * no match is found.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getMetaAnnotationsAsArray(Class)
- */
public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
{
return getMetaAnnotations(metaAnnotationType).toArray(new Annotation[0]);
}
- /**
- * Gets all annotations on this item
- *
- * Populates the annotationSet if it was empty
- *
- * @return The set of annotations on this item.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getAnnotations()
- */
public Set<Annotation> getAnnotations()
{
- return getAnnotationStore().getAnnotationSet();
+ return getAnnotationStore().getAnnotations();
}
/**
@@ -157,7 +111,7 @@
*/
public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
{
- return getAnnotationStore().getAnnotationMap().containsKey(annotatedType);
+ return getAnnotationStore().isAnnotationPresent(annotatedType);
}
/**
@@ -258,26 +212,10 @@
return toString;
}
- /**
- * Gets the binding types of the item
- *
- * Looks at the meta-annotations map for annotations with binding type
- * meta-annotation. Returns default binding (current) if none specified.
- *
- * @return A set of (binding type) annotations
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getBindingTypes()
- */
+ @Deprecated
public Set<Annotation> getBindingTypes()
{
- if (getMetaAnnotations(BindingType.class).size() > 0)
- {
- return Collections.unmodifiableSet(getMetaAnnotations(BindingType.class));
- }
- else
- {
- return Collections.unmodifiableSet(DEFAULT_BINDING);
- }
+ return getAnnotationStore().getBindingTypes();
}
/**
@@ -290,16 +228,10 @@
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getBindingTypesAsArray()
*/
+ @Deprecated
public Annotation[] getBindingTypesAsArray()
{
- if (getMetaAnnotationsAsArray(BindingType.class).length > 0)
- {
- return getMetaAnnotationsAsArray(BindingType.class);
- }
- else
- {
- return DEFAULT_BINDING_ARRAY;
- }
+ return getAnnotationStore().getBindingTypesAsArray();
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -28,7 +28,6 @@
import org.jboss.webbeans.introspector.AnnotatedAnnotation;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedAnnotation;
import org.jboss.webbeans.util.Strings;
import com.google.common.collect.ForwardingMap;
@@ -42,20 +41,8 @@
*
* @param <T>
*/
-public class AnnotatedAnnotationImpl<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>, WrappableAnnotatedAnnotation<T>
+public class AnnotatedAnnotationImpl<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
{
-
- abstract static class ForwardingWrappableAnnotatedAnnotation<T extends Annotation> extends ForwardingAnnotatedAnnotation<T> implements WrappableAnnotatedType<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedAnnotation<T> delegate();
-
- public AnnotationStore getAnnotationStore()
- {
- return delegate().getAnnotationStore();
- }
- }
/**
* A (annotation type -> set of method abstractions with annotation) map
@@ -208,17 +195,7 @@
public AnnotatedAnnotation<T> wrap(Set<Annotation> annotations)
{
- final WrappableAnnotatedAnnotation<T> delegate = this;
- return new ForwardingWrappableAnnotatedAnnotation<T>()
- {
-
- @Override
- protected WrappableAnnotatedAnnotation<T> delegate()
- {
- return delegate;
- }
-
- };
+ throw new UnsupportedOperationException();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -37,7 +37,6 @@
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedClass;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -53,22 +52,9 @@
*
* @param <T>
*/
-public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>, WrappableAnnotatedClass<T>
+public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
{
- abstract static class ForwardingWrappableAnnotatedClass<T> extends ForwardingAnnotatedClass<T> implements WrappableAnnotatedClass<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedClass<T> delegate();
-
-
- public AnnotationStore getAnnotationStore()
- {
- return delegate().getAnnotationStore();
- }
- }
-
/**
* A (annotation type -> set of field abstractions with annotation/meta
* annotation) map
@@ -629,17 +615,7 @@
public AnnotatedClass<T> wrap(Set<Annotation> annotations)
{
- final WrappableAnnotatedClass<T> delegate = this;
- return new ForwardingWrappableAnnotatedClass<T>()
- {
-
- @Override
- protected WrappableAnnotatedClass<T> delegate()
- {
- return delegate;
- }
-
- };
+ throw new UnsupportedOperationException();
}
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -32,7 +32,6 @@
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedConstructor;
import org.jboss.webbeans.util.Names;
/**
@@ -44,22 +43,9 @@
*
* @param <T>
*/
-public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements WrappableAnnotatedConstructor<T>
+public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
{
- static abstract class ForwardingWrappableAnnotatedConstructor<T> extends ForwardingAnnotatedConstructor<T> implements WrappableAnnotatedConstructor<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedConstructor<T> delegate();
-
- public AnnotationStore getAnnotationStore()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
// The type arguments
private static final Type[] actualTypeArguments = new Type[0];
@@ -286,19 +272,9 @@
return toString;
}
- public WrappableAnnotatedConstructor<T> wrap(Set<Annotation> annotations)
+ public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)
{
- final WrappableAnnotatedConstructor<T> delegate = this;
- return new ForwardingWrappableAnnotatedConstructor<T>()
- {
-
- @Override
- protected WrappableAnnotatedConstructor<T> delegate()
- {
- return delegate;
- }
-
- };
+ throw new UnsupportedOperationException();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -40,22 +40,9 @@
*
* @param <T>
*/
-public class AnnotatedFieldImpl<T> extends AbstractAnnotatedMember<T, Field> implements WrappableAnnotatedField<T>
+public class AnnotatedFieldImpl<T> extends AbstractAnnotatedMember<T, Field> implements AnnotatedField<T>
{
- static abstract class ForwardingWrappableAnnotatedField<T> extends ForwardingAnnotatedField<T> implements WrappableAnnotatedField<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedField<T> delegate();
-
- public AnnotationStore getAnnotationStore()
- {
- return delegate().getAnnotationStore();
- }
-
- }
-
// The actual type arguments
private final Type[] actualTypeArguments;
// The underlying field
@@ -208,23 +195,61 @@
{
if (annotations.size() > 0)
{
- final WrappableAnnotatedField<T> delegate = this;
+ final AnnotatedField<T> delegate = this;
final AnnotationStore annotationStore = AnnotationStore.wrap(getAnnotationStore(), annotations, annotations);
- return new ForwardingWrappableAnnotatedField<T>()
+ return new ForwardingAnnotatedField<T>()
{
@Override
- protected WrappableAnnotatedField<T> delegate()
+ protected AnnotatedField<T> delegate()
{
return delegate;
}
@Override
- public AnnotationStore getAnnotationStore()
+ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
{
- return annotationStore;
+ return annotationStore.getAnnotation(annotationType);
}
+ @Override
+ public Set<Annotation> getAnnotations()
+ {
+ return annotationStore.getAnnotations();
+ }
+
+ @Override
+ @Deprecated
+ public Set<Annotation> getBindingTypes()
+ {
+ return annotationStore.getBindingTypes();
+ }
+
+ @Override
+ @Deprecated
+ public Annotation[] getBindingTypesAsArray()
+ {
+ return annotationStore.getBindingTypesAsArray();
+ }
+
+ @Override
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getDeclaredMetaAnnotations(metaAnnotationType);
+ }
+
+ @Override
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getMetaAnnotations(metaAnnotationType);
+ }
+
+ @Override
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getMetaAnnotationsAsArray(metaAnnotationType);
+ }
+
};
}
else
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -44,21 +44,8 @@
*
* @param <T>
*/
-public class AnnotatedMethodImpl<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>, WrappableAnnotatedMethod<T>
+public class AnnotatedMethodImpl<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
{
-
- abstract static class ForwardingWrappableAnnotatedMethod<T> extends ForwardingAnnotatedMethod<T> implements WrappableAnnotatedMethod<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedMethod<T> delegate();
-
- public AnnotationStore getAnnotationStore()
- {
- return delegate().getAnnotationStore();
- }
-
- }
// The actual type arguments
private final Type[] actualTypeArguments;
@@ -84,23 +71,7 @@
{
return new AnnotatedMethodImpl<T>(method, declaringClass);
}
-
- public static <T> AnnotatedMethod<T> wrap(final AnnotatedMethod<T> annotatedMethod, final Set<Annotation> extraAnnotations)
- {
- return new ForwardingAnnotatedMethod<T>()
- {
- @Override
- protected AnnotatedMethod<T> delegate()
- {
- return annotatedMethod;
- }
-
-
-
- };
- }
-
/**
* Constructor
*
@@ -362,23 +333,61 @@
{
if (annotations.size() > 0)
{
- final WrappableAnnotatedMethod<T> delegate = this;
+ final AnnotatedMethod<T> delegate = this;
final AnnotationStore annotationStore = AnnotationStore.wrap(getAnnotationStore(), annotations, annotations);
- return new ForwardingWrappableAnnotatedMethod<T>()
+ return new ForwardingAnnotatedMethod<T>()
{
@Override
- protected WrappableAnnotatedMethod<T> delegate()
+ protected AnnotatedMethod<T> delegate()
{
return delegate;
}
@Override
- public AnnotationStore getAnnotationStore()
+ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
{
- return annotationStore;
+ return annotationStore.getAnnotation(annotationType);
}
+ @Override
+ public Set<Annotation> getAnnotations()
+ {
+ return annotationStore.getAnnotations();
+ }
+
+ @Override
+ @Deprecated
+ public Set<Annotation> getBindingTypes()
+ {
+ return annotationStore.getBindingTypes();
+ }
+
+ @Override
+ @Deprecated
+ public Annotation[] getBindingTypesAsArray()
+ {
+ return annotationStore.getBindingTypesAsArray();
+ }
+
+ @Override
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getDeclaredMetaAnnotations(metaAnnotationType);
+ }
+
+ @Override
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getMetaAnnotations(metaAnnotationType);
+ }
+
+ @Override
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+ {
+ return annotationStore.getMetaAnnotationsAsArray(metaAnnotationType);
+ }
+
};
}
else
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.introspector.AnnotatedMember;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedParameter;
/**
* Represents a parameter
@@ -37,22 +36,9 @@
*
* @param <T>
*/
-public class AnnotatedParameterImpl<T> extends AbstractAnnotatedItem<T, Object> implements WrappableAnnotatedParameter<T>
+public class AnnotatedParameterImpl<T> extends AbstractAnnotatedItem<T, Object> implements AnnotatedParameter<T>
{
- static abstract class ForwardingWrappableAnnotatedParameter<T> extends ForwardingAnnotatedParameter<T> implements WrappableAnnotatedParameter<T>
- {
-
- @Override
- protected abstract WrappableAnnotatedParameter<T> delegate();
-
- public AnnotationStore getAnnotationStore()
- {
- return delegate().getAnnotationStore();
- }
-
- }
-
// The type
private final Class<T> type;
// The actual type arguments
@@ -206,18 +192,7 @@
public AnnotatedParameter<T> wrap(Set<Annotation> annotations)
{
- final WrappableAnnotatedParameter<T> delegate = this;
-
- return new ForwardingWrappableAnnotatedParameter<T>()
- {
-
- @Override
- protected WrappableAnnotatedParameter<T> delegate()
- {
- return delegate;
- }
-
- };
+ throw new UnsupportedOperationException();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotationStore.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotationStore.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotationStore.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -4,18 +4,30 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import javax.webbeans.BindingType;
+
+import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.util.Strings;
import com.google.common.collect.ForwardingMap;
public class AnnotationStore
{
+
+ // The array of default binding types
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentLiteral() };
+ // The set of default binding types
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
+ private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+
/**
* Represents a mapping from a annotation type to an annotation
* implementation
@@ -241,52 +253,63 @@
}
}
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getAnnotationMap()
- */
- public Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
+ public Set<Annotation> getAnnotations()
{
- return Collections.unmodifiableMap(annotationMap);
+ return Collections.unmodifiableSet(annotationSet);
}
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getAnnotationSet()
- */
- public Set<Annotation> getAnnotationSet()
+
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableSet(annotationSet);
+ return Collections.unmodifiableSet(metaAnnotationMap.get(metaAnnotationType));
}
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getMetaAnnotationMap()
- */
- public Map<Class<? extends Annotation>, Set<Annotation>> getMetaAnnotationMap()
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableMap(metaAnnotationMap);
+ return Collections.unmodifiableSet(declaredMetaAnnotationMap.get(metaAnnotationType));
}
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getDeclaredAnnotationMap()
- */
- public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap()
+
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableMap(declaredAnnotationMap);
+ return getMetaAnnotations(metaAnnotationType).toArray(EMPTY_ANNOTATION_ARRAY);
}
+
+ @Deprecated
+ public Set<Annotation> getBindingTypes()
+ {
+ if (getMetaAnnotations(BindingType.class).size() > 0)
+ {
+ return Collections.unmodifiableSet(getMetaAnnotations(BindingType.class));
+ }
+ else
+ {
+ return Collections.unmodifiableSet(DEFAULT_BINDING);
+ }
+ }
+
+ @Deprecated
+ public Annotation[] getBindingTypesAsArray()
+ {
+ return getBindingTypes().toArray(EMPTY_ANNOTATION_ARRAY);
+ }
+
+ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
+ {
+ return annotationType.cast(annotationMap.get(annotationType));
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return annotationMap.containsKey(annotationType);
+ }
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getDeclaredAnnotationSet()
- */
- public Set<Annotation> getDeclaredAnnotationSet()
+ public AnnotationMap getAnnotationMap()
{
- return Collections.unmodifiableSet(declaredAnnotationSet);
+ return annotationMap;
}
- /* (non-Javadoc)
- * @see org.jboss.webbeans.introspector.jlr.AnnotationStore#getDeclaredMetaAnnotationMap()
- */
- public Map<Class<? extends Annotation>, Set<Annotation>> getDeclaredMetaAnnotationMap()
+ public AnnotationMap getDeclaredAnnotationMap()
{
- return Collections.unmodifiableMap(declaredMetaAnnotationMap);
+ return declaredAnnotationMap;
}
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedAnnotation.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedAnnotation.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.introspector.AnnotatedAnnotation;
-
-interface WrappableAnnotatedAnnotation<T extends Annotation> extends AnnotatedAnnotation<T>, WrappableAnnotatedType<T>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedClass.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedClass.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,8 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import org.jboss.webbeans.introspector.AnnotatedClass;
-
-public interface WrappableAnnotatedClass<T> extends AnnotatedClass<T>, WrappableAnnotatedType<T>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedConstructor.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedConstructor.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.reflect.Constructor;
-
-import org.jboss.webbeans.introspector.AnnotatedConstructor;
-
-interface WrappableAnnotatedConstructor<T> extends AnnotatedConstructor<T>, WrappableAnnotatedItem<T, Constructor<T>>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedField.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedField.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.reflect.Field;
-
-import org.jboss.webbeans.introspector.AnnotatedField;
-
-interface WrappableAnnotatedField<T> extends AnnotatedField<T>, WrappableAnnotatedItem<T, Field>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedItem.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedItem.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import org.jboss.webbeans.introspector.AnnotatedItem;
-
-interface WrappableAnnotatedItem<T, S> extends AnnotatedItem<T, S>
-{
-
- AnnotationStore getAnnotationStore();
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMember.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMember.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.reflect.Member;
-
-import org.jboss.webbeans.introspector.AnnotatedMember;
-
-interface WrappableAnnotatedMember<T, S extends Member> extends AnnotatedMember<T, S>, WrappableAnnotatedItem<T, S>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMethod.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedMethod.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,11 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.reflect.Method;
-
-import org.jboss.webbeans.introspector.AnnotatedMember;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-interface WrappableAnnotatedMethod<T> extends AnnotatedMethod<T>, WrappableAnnotatedItem<T, Method>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedParameter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedParameter.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedParameter.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,8 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-
-interface WrappableAnnotatedParameter<T> extends AnnotatedParameter<T>, WrappableAnnotatedItem<T, Object>
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedType.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/WrappableAnnotatedType.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -1,8 +0,0 @@
-package org.jboss.webbeans.introspector.jlr;
-
-import org.jboss.webbeans.introspector.AnnotatedType;
-
-interface WrappableAnnotatedType<T> extends AnnotatedType<T>, WrappableAnnotatedItem<T, Class<T>>
-{
-
-}
\ No newline at end of file
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java 2009-01-20 22:31:23 UTC (rev 1133)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java 2009-01-20 23:32:58 UTC (rev 1134)
@@ -54,7 +54,7 @@
assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
}
- @Test(groups="broken") @SpecAssertion(section="4.1")
+ @Test at SpecAssertion(section="4.1")
public void testRealizedBeanWithProducerMethodHasBindingsOfMethodAndRealizingType()
{
deployBeans(TameCow.class);
@@ -102,13 +102,13 @@
assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
}
- @Test(groups="broken") @SpecAssertion(section="4.1")
+ @Test @SpecAssertion(section="4.1")
public void testRealizedBeanWithProducerFieldHasBindingsOfMethodAndRealizingType()
{
deployBeans(TameHorse.class);
- assert manager.resolveByType(Dung.class).size() == 1;
- assert manager.resolveByType(Dung.class).iterator().next().getBindings().size() == 2;
- assert annotationSetMatches(manager.resolveByType(Dung.class).iterator().next().getBindings(), Smelly.class, Tame.class);
+ assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
+ assert annotationSetMatches(manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
}
@Test @SpecAssertion(section="4.1")
More information about the weld-commits
mailing list