[webbeans-commits] Webbeans SVN: r372 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-27 09:19:40 -0500 (Thu, 27 Nov 2008)
New Revision: 372
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/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/AnnotatedItemImpl.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
Log:
some javadocs/comments
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -80,7 +80,7 @@
* annotations
*
*/
- public static class MetaAnnotationMap extends ForwardingMap<Class<? extends Annotation>, Set<Annotation>>
+ private static class MetaAnnotationMap extends ForwardingMap<Class<? extends Annotation>, Set<Annotation>>
{
private Map<Class<? extends Annotation>, Set<Annotation>> delegate;
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -48,7 +48,10 @@
public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
{
- protected static class AnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
+ /**
+ * A (annotation type -> set of field abstractions with annotation) map
+ */
+ private static class AnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate;
@@ -64,7 +67,10 @@
}
}
- protected static class MetaAnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
+ /**
+ * A (annotation type -> set of field abstractions with meta-annotation) map
+ */
+ private static class MetaAnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate;
@@ -80,7 +86,10 @@
}
}
- protected class AnnotatedMethods extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>
+ /**
+ * A (annotation type -> set of method abstractions with annotation) map
+ */
+ private class AnnotatedMethods extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> delegate;
@@ -96,7 +105,10 @@
}
}
- protected class AnnotatedConstructors extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
+ /**
+ * A (annotation type -> set of constructor abstractions with annotation) map
+ */
+ private class AnnotatedConstructors extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate;
@@ -112,7 +124,10 @@
}
}
- protected class ConstructorsByArgument extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
+ /**
+ * A (class list -> set of constructor abstractions with matching parameters) map
+ */
+ private class ConstructorsByArgument extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
{
private Map<List<Class<?>>, AnnotatedConstructor<T>> delegate;
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
@@ -16,18 +33,58 @@
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
+import com.google.common.collect.ForwardingMap;
+
+/**
+ * Represents an annotated constructor
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
{
+ /**
+ * An annotation type -> list of annotations map
+ */
+ private class AnnotatedParameters extends ForwardingMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>
+ {
+ private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> delegate;
+
+ public AnnotatedParameters()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ // The type arguments
private static final Type[] actualTypeArguments = new Type[0];
-
+ // The underlying constructor
private Constructor<T> constructor;
-
+
+ // The list of parameter abstractions
private List<AnnotatedParameter<Object>> parameters;
- private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
-
+ // The mapping of annotation -> parameter abstraction
+ private AnnotatedParameters annotatedParameters;
+
+ // The declaring class abstraction
private AnnotatedType<T> declaringClass;
-
+
+ /**
+ * Constructor
+ *
+ * Initializes the superclass with the build annotations map
+ *
+ * @param constructor The constructor method
+ * @param declaringClass The declaring class
+ */
public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
{
super(buildAnnotationMap(constructor));
@@ -35,26 +92,53 @@
this.declaringClass = declaringClass;
}
+ /**
+ * Gets the constructor
+ *
+ * @return The constructor
+ */
public Constructor<T> getAnnotatedConstructor()
{
return constructor;
}
+ /**
+ * Gets the delegate (constructor)
+ *
+ * @return The delegate
+ */
public Constructor<T> getDelegate()
{
return constructor;
}
-
+
+ /**
+ * Gets the type of the constructor
+ *
+ * @return The type of the constructor
+ */
public Class<T> getType()
{
return constructor.getDeclaringClass();
}
-
+
+ /**
+ * Gets the actual type arguments
+ *
+ * @return The type arguments
+ */
public Type[] getActualTypeArguments()
{
return actualTypeArguments;
}
-
+
+ /**
+ * Gets the abstracted parameters
+ *
+ * If the parameters are null, initalize them first
+ *
+ * @return A list of annotated parameter abstractions
+ */
public List<AnnotatedParameter<Object>> getParameters()
{
if (parameters == null)
@@ -63,10 +147,17 @@
}
return parameters;
}
-
+
+ /**
+ * Initializes the parameter abstractions
+ *
+ * Iterates over the constructor parameters, adding the parameter abstraction
+ * to the parameters list.
+ */
+ @SuppressWarnings("unchecked")
private void initParameters()
{
- this.parameters = new ArrayList<AnnotatedParameter<Object>>();
+ parameters = new ArrayList<AnnotatedParameter<Object>>();
for (int i = 0; i < constructor.getParameterTypes().length; i++)
{
if (constructor.getParameterAnnotations()[i].length > 0)
@@ -83,14 +174,23 @@
}
}
}
-
+
+ /**
+ * Gets the parameter abstractions with a given annotation type
+ *
+ * if the annotated parameters map is null, it is initialized first.
+ *
+ * @param annotationType The annotation type to match
+ * @return The list of parameter abstractions with given annotation type. An
+ * empty list is returned if there are no matches.
+ */
public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
{
if (annotatedParameters == null)
{
initAnnotatedParameters();
}
-
+
if (!annotatedParameters.containsKey(annotationType))
{
return new ArrayList<AnnotatedParameter<Object>>();
@@ -101,13 +201,20 @@
}
}
+ /**
+ * Initializes the annotated parameters
+ *
+ * If the parameters are null, they are initialized first. Iterate over the
+ * parameters and for each parameter annotation map it under the annotation
+ * type.
+ */
private void initAnnotatedParameters()
{
if (parameters == null)
{
initParameters();
}
- annotatedParameters = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
+ annotatedParameters = new AnnotatedParameters();
for (AnnotatedParameter<Object> parameter : parameters)
{
for (Annotation annotation : parameter.getAnnotations())
@@ -121,6 +228,15 @@
}
}
+ /**
+ * Gets parameter abstractions with a given annotation type.
+ *
+ * If the parameters are null, they are initializes first.
+ *
+ * @param annotationType The annotation type to match
+ * @return A list of matching parameter abstractions. An empty list is
+ * returned if there are no matches.
+ */
public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
{
if (annotatedParameters == null)
@@ -133,11 +249,18 @@
}
return annotatedParameters.get(annotationType);
}
-
+
+ /**
+ * Creates a new instance
+ *
+ * @param manager The Web Beans manager
+ * @return An instance
+ */
public T newInstance(ManagerImpl manager)
{
try
{
+ // TODO: more details in the exceptions
return getDelegate().newInstance(getParameterValues(parameters, manager));
}
catch (IllegalArgumentException e)
@@ -157,11 +280,17 @@
throw new ExecutionException(e);
}
}
-
+
+ /**
+ * The overridden equals operation
+ *
+ * @param other The instance to compare to
+ * @return True if equal, false otherwise
+ */
@Override
public boolean equals(Object other)
{
-
+
if (super.equals(other) && other instanceof AnnotatedConstructor)
{
AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
@@ -169,13 +298,25 @@
}
return false;
}
-
+
+ /**
+ * The overridden hashcode
+ *
+ * Gets the hash code from the delegate
+ *
+ * @return The hash code
+ */
@Override
public int hashCode()
{
return getDelegate().hashCode();
}
-
+
+ /**
+ * Gets the declaring class
+ *
+ * @return The declaring class
+ */
public AnnotatedType<T> getDeclaringClass()
{
return declaringClass;
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.reflect.Field;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
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 2008-11-27 13:33:35 UTC (rev 371)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-11-27 14:19:40 UTC (rev 372)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
16 years
[webbeans-commits] Webbeans SVN: r371 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector: jlr and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-27 08:33:35 -0500 (Thu, 27 Nov 2008)
New Revision: 371
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
Log:
some javadocs/comments
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-27 11:00:34 UTC (rev 370)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-27 13:33:35 UTC (rev 371)
@@ -115,7 +115,7 @@
/**
* Checks if any of the types provided are assignable to this, using
- * the extended assingablity algorithm provided by AnnotatedItem.
+ * the extended assignability algorithm provided by AnnotatedItem.
*
* The types are assumed to contain their own actual type parameterization.
*
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 2008-11-27 11:00:34 UTC (rev 370)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-27 13:33:35 UTC (rev 371)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
@@ -19,29 +36,132 @@
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+import com.google.common.collect.ForwardingMap;
+
/**
- * Base class for implementing AnnotatedItem.
+ * Represents an annotated class
*
- * @author pmuir
+ * @author Pete Muir
*
+ * @param <T>
*/
public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
{
+ protected static class AnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
+ {
+ private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate;
+
+ public AnnotatedFields()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ protected static class MetaAnnotatedFields extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>
+ {
+ private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate;
+
+ public MetaAnnotatedFields()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ protected class AnnotatedMethods extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>
+ {
+ private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> delegate;
+
+ public AnnotatedMethods()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ protected class AnnotatedConstructors extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
+ {
+ private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate;
+
+ public AnnotatedConstructors()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ protected class ConstructorsByArgument extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
+ {
+ private Map<List<Class<?>>, AnnotatedConstructor<T>> delegate;
+
+ public ConstructorsByArgument()
+ {
+ delegate = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
+ }
+
+ @Override
+ protected Map<List<Class<?>>, AnnotatedConstructor<T>> delegate()
+ {
+ return delegate;
+ }
+ }
+
+ // The implementing class
private Class<T> clazz;
+ // The type arguments
private Type[] actualTypeArguments;
+ // The set of abstracted fields
private Set<AnnotatedField<Object>> fields;
- private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields;
- private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields;
+ // The map from annotation type to abstracted field with annotation
+ private AnnotatedFields annotatedFields;
+ // The map from annotation type to abstracted field with meta-annotation
+ private MetaAnnotatedFields metaAnnotatedFields;
+ // The set of abstracted methods
private Set<AnnotatedMethod<Object>> methods;
- private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> annotatedMethods;
+ // The map from annotation type to abstracted method with annotation
+ private AnnotatedMethods annotatedMethods;
+ // The set of abstracted constructors
private Set<AnnotatedConstructor<T>> constructors;
- private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> annotatedConstructors;
- private Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
+ // The map from annotation type to abstracted constructor with annotation
+ private AnnotatedConstructors annotatedConstructors;
+ // The map from class list to abstracted constructor
+ private ConstructorsByArgument constructorsByArgumentMap;
+ /**
+ * Constructor
+ *
+ * Initializes superclass with built annotation map, sets the raw type and
+ * determines the actual type arguments
+ *
+ * @param rawType The raw type of the class
+ * @param type The type of the class
+ * @param annotations The array of annotations on the class
+ */
public AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations)
{
super(buildAnnotationMap(annotations));
@@ -56,21 +176,45 @@
}
}
+ /**
+ * Constructor
+ *
+ * Calls another constructor with the class annotations array
+ *
+ * @param clazz The implementing class
+ */
public AnnotatedClassImpl(Class<T> clazz)
{
this(clazz, clazz, clazz.getAnnotations());
}
+ /**
+ * Gets the implementing class
+ *
+ * @return The class
+ */
public Class<? extends T> getAnnotatedClass()
{
return clazz;
}
+ /**
+ * Gets the delegate (class)
+ *
+ * @return The class
+ */
public Class<T> getDelegate()
{
return clazz;
}
+ /**
+ * Gets the abstracted fields of the class
+ *
+ * Initializes the fields if they are null
+ *
+ * @return The set of abstracted fields
+ */
public Set<AnnotatedField<Object>> getFields()
{
if (fields == null)
@@ -80,6 +224,13 @@
return fields;
}
+ /**
+ * Gets the abstracted constructors of the class
+ *
+ * Initializes the constructors if they are null
+ *
+ * @return The set of abstracted constructors
+ */
public Set<AnnotatedConstructor<T>> getConstructors()
{
if (constructors == null)
@@ -89,25 +240,46 @@
return constructors;
}
+ /**
+ * Initializes the fields
+ *
+ * Iterates through the type hierarchy and adds the abstracted fields to the
+ * fields list
+ *
+ */
private void initFields()
{
this.fields = new HashSet<AnnotatedField<Object>>();
- for (Class c = clazz; c != Object.class; c = c.getSuperclass())
+ for (Class<?> c = clazz; c != Object.class; c = c.getSuperclass())
{
for (Field field : clazz.getDeclaredFields())
{
if (!field.isAccessible())
+ {
field.setAccessible(true);
+ }
fields.add(new AnnotatedFieldImpl<Object>(field, this));
}
}
}
+ /**
+ * Gets abstracted fields with requested meta-annotation type present
+ *
+ * If the meta-annotations map is null, it is initializes. If the annotated
+ * fields are null, it is initialized The meta-annotated field map is then
+ * populated for the requested meta-annotation type and the result is
+ * returned
+ *
+ * @param metaAnnotationType The meta-annotation type to match
+ * @return The set of abstracted fields with meta-annotation present. Returns
+ * an empty set if no matches are found.
+ */
public Set<AnnotatedField<Object>> getMetaAnnotatedFields(Class<? extends Annotation> metaAnnotationType)
{
if (metaAnnotatedFields == null)
{
- metaAnnotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ metaAnnotatedFields = new MetaAnnotatedFields();
}
if (annotatedFields == null)
{
@@ -117,7 +289,16 @@
return metaAnnotatedFields.get(metaAnnotationType);
}
- protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> populateMetaAnnotatedFieldMap(Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields, Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields)
+ /**
+ * Populates the meta annotated fields map for a meta-annotation type
+ *
+ * @param <T>
+ * @param metaAnnotationType The meta-annotation to examine
+ * @param annotatedFields The annotated fields
+ * @param metaAnnotatedFields The meta-annotated fields
+ * @return The meta-annotated fields map
+ */
+ protected static <T extends Annotation> MetaAnnotatedFields populateMetaAnnotatedFieldMap(Class<T> metaAnnotationType, AnnotatedFields annotatedFields, MetaAnnotatedFields metaAnnotatedFields)
{
if (!metaAnnotatedFields.containsKey(metaAnnotationType))
{
@@ -134,6 +315,15 @@
return metaAnnotatedFields;
}
+ /**
+ * Gets the abstracted field annotated with a specific annotation type
+ *
+ * If the fields map is null, initialize it first
+ *
+ * @param annotationType The annotation type to match
+ * @return A set of matching abstracted fields, null if none are found.
+ *
+ */
public Set<AnnotatedField<Object>> getAnnotatedFields(Class<? extends Annotation> annotationType)
{
if (annotatedFields == null)
@@ -143,13 +333,20 @@
return annotatedFields.get(annotationType);
}
+ /**
+ * Initializes the annotated fields map
+ *
+ * If the fields set if empty, populate it first. Iterate through the fields,
+ * for each field, iterate over the annotations and map the field abstraction
+ * under the annotation type key.
+ */
private void initAnnotatedFields()
{
if (fields == null)
{
initFields();
}
- annotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ annotatedFields = new AnnotatedFields();
for (AnnotatedField<Object> field : fields)
{
for (Annotation annotation : field.getAnnotations())
@@ -163,30 +360,57 @@
}
}
+ /**
+ * Gets the type of the class
+ *
+ * @return The type
+ */
public Class<T> getType()
{
return clazz;
}
+ /**
+ * Gets the actual type arguments
+ *
+ * @return The type arguments
+ */
public Type[] getActualTypeArguments()
{
return actualTypeArguments;
}
+ /**
+ * Initializes the methods
+ *
+ * Iterate over the class hierarchy and for each type, add all methods
+ * abstracted to the methods list
+ */
private void initMethods()
{
this.methods = new HashSet<AnnotatedMethod<Object>>();
- for (Class c = clazz; c != Object.class; c = c.getSuperclass())
+ for (Class<?> c = clazz; c != Object.class; c = c.getSuperclass())
{
for (Method method : clazz.getDeclaredMethods())
{
if (!method.isAccessible())
+ {
method.setAccessible(true);
+ }
methods.add(new AnnotatedMethodImpl<Object>(method, this));
}
}
}
+ /**
+ * Gets the abstracted methods that have a certain annotation type present
+ *
+ * If the annotated methods map is null, initialize it first
+ *
+ * @param annotationType The annotation type to match
+ * @return A set of matching method abstractions. Returns an empty set if no
+ * matches are found.
+ */
public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
{
if (annotatedMethods == null)
@@ -204,13 +428,20 @@
}
}
+ /**
+ * Initializes the annotated methods
+ *
+ * If the methods set is null, initialize it first. Iterate over all method
+ * abstractions and for each annotation, map the method abstraction under the
+ * annotation type key.
+ */
private void initAnnotatedMethods()
{
if (methods == null)
{
initMethods();
}
- annotatedMethods = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>();
+ annotatedMethods = new AnnotatedMethods();
for (AnnotatedMethod<Object> member : methods)
{
for (Annotation annotation : member.getAnnotations())
@@ -224,20 +455,38 @@
}
}
+ /**
+ * Initializes the constructors set and constructors-by-argument map
+ *
+ * Iterate over the constructors and for each constructor, add an abstracted
+ * constructor to the constructors set and the same constructor abstraction
+ * to the constructors-by-argument map under the argument-list-key.
+ */
+ @SuppressWarnings("unchecked")
private void initConstructors()
{
this.constructors = new HashSet<AnnotatedConstructor<T>>();
- this.constructorsByArgumentMap = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
+ this.constructorsByArgumentMap = new ConstructorsByArgument();
for (Constructor<?> constructor : clazz.getDeclaredConstructors())
{
AnnotatedConstructor<T> annotatedConstructor = new AnnotatedConstructorImpl<T>((Constructor<T>) constructor, this);
if (!constructor.isAccessible())
+ {
constructor.setAccessible(true);
+ }
constructors.add(annotatedConstructor);
constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
}
}
+ /**
+ * Gets constructors with given annotation type
+ *
+ * @param annotationType The annotation type to match
+ * @return A set of abstracted constructors with given annotation type. If
+ * the constructors set is empty, initialize it first .Returns an
+ * empty set if there are no matches.
+ */
public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
{
if (annotatedConstructors == null)
@@ -255,13 +504,20 @@
}
}
+ /**
+ * Initializes the annotated constructors.
+ *
+ * If the constructors set is empty, initialize it first. Iterate over all
+ * constructor abstractions and for each annotation on the constructor, map
+ * the constructor abstraction under the annotation key.
+ */
private void initAnnotatedConstructors()
{
if (constructors == null)
{
initConstructors();
}
- annotatedConstructors = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
+ annotatedConstructors = new AnnotatedConstructors();
for (AnnotatedConstructor<T> constructor : constructors)
{
for (Annotation annotation : constructor.getAnnotations())
16 years
[webbeans-commits] Webbeans SVN: r370 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-27 06:00:34 -0500 (Thu, 27 Nov 2008)
New Revision: 370
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/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
Log:
Some javadocs/comments
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 2008-11-27 07:52:23 UTC (rev 369)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-27 11:00:34 UTC (rev 370)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
@@ -11,9 +28,7 @@
import java.util.Map;
import java.util.Set;
-import javax.webbeans.AnnotationLiteral;
import javax.webbeans.BindingType;
-import javax.webbeans.Stereotype;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
@@ -24,9 +39,25 @@
import com.google.common.collect.ForwardingMap;
+/**
+ * Represents functionality common for all annotated items, mainly different
+ * mappings of the annotations and meta-annotations
+ *
+ * @author Pete Muir
+ * @author Nicklas Karlsson
+ *
+ * @param <T>
+ * @param <S>
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedItem
+ */
public abstract class AbstractAnnotatedItem<T, S> implements AnnotatedItem<T, S>
{
+ /**
+ * Represents a mapping from a annotation type to an annotation
+ * implementation
+ */
public static class AnnotationMap extends ForwardingMap<Class<? extends Annotation>, Annotation>
{
private Map<Class<? extends Annotation>, Annotation> delegate;
@@ -44,6 +75,11 @@
}
+ /**
+ * Represents a mapping from a annotation (meta-annotation) to a set of
+ * annotations
+ *
+ */
public static class MetaAnnotationMap extends ForwardingMap<Class<? extends Annotation>, Set<Annotation>>
{
private Map<Class<? extends Annotation>, Set<Annotation>> delegate;
@@ -59,6 +95,16 @@
return delegate;
}
+ /**
+ * Gets the set of annotations matching the given annotation type
+ *
+ * If the key is not found, an empty set is created and placed in the map
+ * before returned
+ *
+ * @param key The meta-annotation to match
+ * @returns The set of matching annotations containing this
+ * meta-annotation
+ */
@SuppressWarnings("unchecked")
@Override
public Set<Annotation> get(Object key)
@@ -74,16 +120,33 @@
}
+ // The array of default binding types
private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentAnnotationLiteral() };
+ // The set of default binding types
private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+ // The array of meta-annotations to map
private static final Annotation[] MAPPED_METAANNOTATIONS_ARRAY = {};
+ // The set of meta-annotations to map
private static final Set<Annotation> MAPPED_METAANNOTATIONS = new HashSet<Annotation>(Arrays.asList(MAPPED_METAANNOTATIONS_ARRAY));
+ // The annotation map (annotation type -> annotation) of the item
private AnnotationMap annotationMap;
+ // The meta-annotation map (annotation type -> set of annotations containing meta-annotation) of the item
private MetaAnnotationMap metaAnnotationMap;
+ // The set of all annotations on the item
private Set<Annotation> annotationSet;
+ // The array of all annotations on the item
private Annotation[] annotationArray;
+ /**
+ * Constructor
+ *
+ * Also builds the meta-annotation map. Throws a NullPointerException if
+ * trying to register a null map
+ *
+ * @param annotationMap A map of annotation to register
+ *
+ */
public AbstractAnnotatedItem(AnnotationMap annotationMap)
{
if (annotationMap == null)
@@ -94,6 +157,15 @@
buildMetaAnnotationMap(annotationMap);
}
+ /**
+ * Build the meta-annotation map
+ *
+ * Iterates through the annotationMap values (annotations) and for each
+ * meta-annotation on the annotation register the annotation in the set under
+ * they key of the meta-annotation type.
+ *
+ * @param annotationMap The annotation map to parse
+ */
private void buildMetaAnnotationMap(AnnotationMap annotationMap)
{
metaAnnotationMap = new MetaAnnotationMap();
@@ -101,20 +173,33 @@
{
for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
{
-// TODO: Check with Pete how to fill the array. Make annotation literals for all?
-// if (MAPPED_METAANNOTATIONS.contains(metaAnnotation))
-// {
- metaAnnotationMap.get(metaAnnotation.annotationType()).add(annotation);
-// }
+ // TODO: Check with Pete how to fill the array. Make annotation
+ // literals for all?
+ // if (MAPPED_METAANNOTATIONS.contains(metaAnnotation))
+ // {
+ metaAnnotationMap.get(metaAnnotation.annotationType()).add(annotation);
+ // }
}
}
}
+ /**
+ * Static helper method for building annotation map from an annotated element
+ *
+ * @param element The element to examine
+ * @return The annotation map
+ */
protected static AnnotationMap buildAnnotationMap(AnnotatedElement element)
{
return buildAnnotationMap(element.getAnnotations());
}
+ /**
+ * Builds the annotation map (annotation type -> annotation)
+ *
+ * @param annotations The array of annotations to map
+ * @return The annotation map
+ */
protected static AnnotationMap buildAnnotationMap(Annotation[] annotations)
{
AnnotationMap annotationMap = new AnnotationMap();
@@ -125,6 +210,14 @@
return annotationMap;
}
+ /**
+ * Static helper method for getting the current parameter values from a list
+ * of annotated parameters.
+ *
+ * @param parameters The list of annotated parameter to look up
+ * @param manager The Web Beans manager
+ * @return The object array of looked up values
+ */
protected static Object[] getParameterValues(List<AnnotatedParameter<Object>> parameters, ManagerImpl manager)
{
Object[] parameterValues = new Object[parameters.size()];
@@ -136,17 +229,40 @@
return parameterValues;
}
+ /**
+ * 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
+ */
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
{
return (A) annotationMap.get(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.
+ */
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
return metaAnnotationMap.get(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.
+ */
public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
{
if (annotationArray == null)
@@ -157,6 +273,13 @@
return annotationArray;
}
+ /**
+ * Gets all annotations on this item
+ *
+ * Populates the annotationSet if it was empty
+ *
+ * @return The set of annotations on this item.
+ */
public Set<Annotation> getAnnotations()
{
if (annotationSet == null)
@@ -167,16 +290,33 @@
return annotationSet;
}
+ /**
+ * Checks if an annotation is present on the item
+ *
+ * @param annotatedType The annotation type to check for
+ * @return True if present, false otherwise.
+ */
public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
{
return annotationMap.containsKey(annotatedType);
}
+ /**
+ * Gets the annotation map
+ *
+ * @return The annotation map
+ */
protected AnnotationMap getAnnotationMap()
{
return annotationMap;
}
+ /**
+ * Compares two AbstractAnnotatedItems
+ *
+ * @param other The other item
+ * @return True if equals, false otherwise
+ */
@Override
public boolean equals(Object other)
{
@@ -188,11 +328,24 @@
return false;
}
+ /**
+ * Checks if this item is assignable from another annotated item (through
+ * type and actual type arguments)
+ *
+ * @param that The other annotated item to check against
+ * @return True if assignable, false otherwise
+ */
public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
{
return isAssignableFrom(that.getType(), that.getActualTypeArguments());
}
+ /**
+ * Checks if this item is assignable from any one a set of types
+ *
+ * @param types The set of types to check against
+ * @return True if assignable, false otherwise
+ */
public boolean isAssignableFrom(Set<Class<?>> types)
{
for (Class<?> type : types)
@@ -205,17 +358,34 @@
return false;
}
+ /**
+ * Helper method for doing actual assignability check
+ *
+ * @param type The type to compare against
+ * @param actualTypeArguments The type arguments
+ * @return True is assignable, false otherwise
+ */
private boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
{
return Types.boxedType(getType()).isAssignableFrom(Types.boxedType(type)) && Arrays.equals(getActualTypeArguments(), actualTypeArguments);
}
+ /**
+ * Gets the hash code of the actual type
+ *
+ * @return The hash code
+ */
@Override
public int hashCode()
{
return getType().hashCode();
}
+ /**
+ * Gets a string representation of the item
+ *
+ * @return A string representation
+ */
@Override
public String toString()
{
@@ -237,6 +407,14 @@
return string;
}
+ /**
+ * 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
+ */
public Set<Annotation> getBindingTypes()
{
if (getMetaAnnotations(BindingType.class).size() > 0)
@@ -249,6 +427,14 @@
}
}
+ /**
+ * Gets (as array) 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 An array of (binding type) annotations
+ */
public Annotation[] getBindingTypesAsArray()
{
if (getMetaAnnotationsAsArray(BindingType.class).length > 0)
@@ -261,6 +447,11 @@
}
}
+ /**
+ * Indicates if the type is proxyable to a set of pre-defined rules
+ *
+ * @return True if proxyable, false otherwise.
+ */
public boolean isProxyable()
{
if (Reflections.getConstructor(getType()) == null)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-11-27 07:52:23 UTC (rev 369)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-11-27 11:00:34 UTC (rev 370)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.reflect.Member;
@@ -7,31 +24,65 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.util.Reflections;
+/**
+ * Represents an abstract annotated memeber (field, method or constructor)
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ * @param <S>
+ */
public abstract class AbstractAnnotatedMember<T, S extends Member> extends AbstractAnnotatedItem<T, S>
{
-
+ // The name of the member
private String name;
+ /**
+ * Constructor
+ *
+ * @param annotationMap The annotation map
+ */
public AbstractAnnotatedMember(AnnotationMap annotationMap)
{
super(annotationMap);
}
-
+
+ /**
+ * Indicates if the member is static (through the delegate)
+ *
+ * @return True if static, false otherwise
+ */
public boolean isStatic()
{
return Reflections.isStatic(getDelegate());
}
-
+
+ /**
+ * Indicates if the member if final (through the delegate)
+ *
+ * @return True if final, false otherwise
+ */
public boolean isFinal()
{
return Reflections.isFinal(getDelegate());
}
-
+
+ /**
+ * Gets the current value of the member
+ *
+ * @param manager The Web Beans manager
+ * @return The current value
+ */
public T getValue(ManagerImpl manager)
{
return manager.getInstanceByType(getType(), getMetaAnnotationsAsArray(BindingType.class));
}
-
+
+ /**
+ * Gets the name of the member
+ *
+ * @returns The name (or the name of the delegate if none is defined)
+ */
public String getName()
{
if (name == null)
@@ -40,5 +91,5 @@
}
return name;
}
-
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-27 07:52:23 UTC (rev 369)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-27 11:00:34 UTC (rev 370)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -3,29 +20,61 @@
import org.jboss.webbeans.util.Reflections;
+/**
+ * Represents an abstract annotated type
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
public abstract class AbstractAnnotatedType<T> extends AbstractAnnotatedItem<T, Class<T>>
{
-
+ // The superclass abstraction of the type
private AnnotatedClass<Object> superclass;
+ /**
+ * Constructor
+ *
+ * @param annotationMap The annotation map
+ */
public AbstractAnnotatedType(AnnotationMap annotationMap)
{
super(annotationMap);
}
+ /**
+ * Indicates if the type is static (through the delegate)
+ *
+ * @return True if static, false otherwise
+ */
public boolean isStatic()
{
return Reflections.isStatic(getDelegate());
}
+ /**
+ * Indicates if the type if final (through the delegate)
+ *
+ * @return True if final, false otherwise
+ */
public boolean isFinal()
{
return Reflections.isFinal(getDelegate());
}
+ /**
+ * Gets the name of the type
+ *
+ * @returns The name (through the delegate)
+ */
public String getName()
{
return getDelegate().getName();
}
+ /**
+ * Gets the superclass abstraction of the type
+ *
+ * @return The superclass abstraction
+ */
@SuppressWarnings("unchecked")
// TODO Fix this
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 2008-11-27 07:52:23 UTC (rev 369)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-11-27 11:00:34 UTC (rev 370)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
@@ -11,26 +28,52 @@
import org.jboss.webbeans.introspector.AnnotatedAnnotation;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+/**
+ * Represents an annotated annotation
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
public class AnnotatedAnnotationImpl<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
{
-
+ // The annotated members map (annotation -> member with annotation)
private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> annotatedMembers;
-
+ // The implementation class of the annotation
private Class<T> clazz;
-
+ // The set of abstracted members
private Set<AnnotatedMethod<?>> members;
-
+
+ /**
+ * Constructor
+ *
+ * Initializes the superclass with the built annotation map
+ *
+ * @param annotationType The annotation type
+ */
public AnnotatedAnnotationImpl(Class<T> annotationType)
{
super(buildAnnotationMap(annotationType));
this.clazz = annotationType;
}
-
+
+ /**
+ * Gets the actual type arguments
+ *
+ * @return The type arguments
+ */
public Type[] getActualTypeArguments()
{
return new Type[0];
}
+ /**
+ * Gets all members of the annotation
+ *
+ * Initializes the members first if they are null
+ *
+ * @return The set of abstracted members
+ */
public Set<AnnotatedMethod<?>> getMembers()
{
if (members == null)
@@ -40,32 +83,55 @@
return members;
}
+ /**
+ * Gets the delegate
+ *
+ * @return The delegate
+ */
public Class<T> getDelegate()
{
return clazz;
}
+ /**
+ * Gets the type of the annotation
+ */
public Class<T> getType()
{
return clazz;
}
-
+
+ /**
+ * Initializes the members
+ *
+ * Iterates through the declared members, creates abstractions of them and
+ * adds them to the members set
+ */
private void initMembers()
{
- this.members = new HashSet<AnnotatedMethod<?>>();
+ members = new HashSet<AnnotatedMethod<?>>();
for (Method member : clazz.getDeclaredMethods())
{
members.add(new AnnotatedMethodImpl<Object>(member, this));
}
}
+ /**
+ * Returns the annotated members with a given annotation type
+ *
+ * If the annotated members are null, they are initialized first.
+ *
+ * @param annotationType The annotation type to match
+ * @return The set of abstracted members with the given annotation type
+ * present. An empty set is returned if no matches are found
+ */
public Set<AnnotatedMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
{
if (annotatedMembers == null)
{
initAnnotatedMembers();
}
-
+
if (!annotatedMembers.containsKey(annotationType))
{
return new HashSet<AnnotatedMethod<?>>();
@@ -76,6 +142,15 @@
}
}
+ /**
+ * Initializes the annotated members
+ *
+ * If the members are null, the are initialized first.
+ *
+ * Iterates over the members and for each member, iterate over the
+ * annotations present, creating member abstractions and mapping them under
+ * the annotation in the annotatedMembers map.
+ */
private void initAnnotatedMembers()
{
if (members == null)
@@ -95,5 +170,5 @@
}
}
}
-
+
}
16 years
[webbeans-commits] Webbeans SVN: r369 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-27 02:52:23 -0500 (Thu, 27 Nov 2008)
New Revision: 369
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
Log:
Parse meta-annotation when setting annotation map (remove lazy-loading). Still not filtering, though.
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 2008-11-26 22:51:40 UTC (rev 368)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-27 07:52:23 UTC (rev 369)
@@ -10,9 +10,10 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
+import javax.webbeans.AnnotationLiteral;
import javax.webbeans.BindingType;
+import javax.webbeans.Stereotype;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
@@ -58,10 +59,25 @@
return delegate;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<Annotation> get(Object key)
+ {
+ Set<Annotation> annotations = super.get(key);
+ if (annotations == null)
+ {
+ annotations = new HashSet<Annotation>();
+ super.put((Class<? extends Annotation>) key, annotations);
+ }
+ return annotations;
+ }
+
}
private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentAnnotationLiteral() };
private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+ private static final Annotation[] MAPPED_METAANNOTATIONS_ARRAY = {};
+ private static final Set<Annotation> MAPPED_METAANNOTATIONS = new HashSet<Annotation>(Arrays.asList(MAPPED_METAANNOTATIONS_ARRAY));
private AnnotationMap annotationMap;
private MetaAnnotationMap metaAnnotationMap;
@@ -75,8 +91,25 @@
throw new NullPointerException("annotationMap cannot be null");
}
this.annotationMap = annotationMap;
+ buildMetaAnnotationMap(annotationMap);
}
+ private void buildMetaAnnotationMap(AnnotationMap annotationMap)
+ {
+ metaAnnotationMap = new MetaAnnotationMap();
+ for (Annotation annotation : annotationMap.values())
+ {
+ for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
+ {
+// TODO: Check with Pete how to fill the array. Make annotation literals for all?
+// if (MAPPED_METAANNOTATIONS.contains(metaAnnotation))
+// {
+ metaAnnotationMap.get(metaAnnotation.annotationType()).add(annotation);
+// }
+ }
+ }
+ }
+
protected static AnnotationMap buildAnnotationMap(AnnotatedElement element)
{
return buildAnnotationMap(element.getAnnotations());
@@ -111,11 +144,6 @@
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- if (metaAnnotationMap == null)
- {
- metaAnnotationMap = new MetaAnnotationMap();
- }
- metaAnnotationMap = populateMetaAnnotationMap(metaAnnotationType, metaAnnotationMap, annotationMap);
return metaAnnotationMap.get(metaAnnotationType);
}
@@ -144,23 +172,6 @@
return annotationMap.containsKey(annotatedType);
}
- protected static <A extends Annotation> MetaAnnotationMap populateMetaAnnotationMap(Class<A> metaAnnotationType, MetaAnnotationMap metaAnnotationMap, AnnotationMap annotationMap)
- {
- if (!metaAnnotationMap.containsKey(metaAnnotationType))
- {
- Set<Annotation> annotations = new HashSet<Annotation>();
- for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
- {
- if (entry.getKey().isAnnotationPresent(metaAnnotationType))
- {
- annotations.add(entry.getValue());
- }
- }
- metaAnnotationMap.put(metaAnnotationType, annotations);
- }
- return metaAnnotationMap;
- }
-
protected AnnotationMap getAnnotationMap()
{
return annotationMap;
16 years
[webbeans-commits] Webbeans SVN: r368 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 17:51:40 -0500 (Wed, 26 Nov 2008)
New Revision: 368
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/AnnotatedClassImpl.java
Log:
Minor cosmetic stuff
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 2008-11-26 22:23:32 UTC (rev 367)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-26 22:51:40 UTC (rev 368)
@@ -148,15 +148,15 @@
{
if (!metaAnnotationMap.containsKey(metaAnnotationType))
{
- Set<Annotation> s = new HashSet<Annotation>();
+ Set<Annotation> annotations = new HashSet<Annotation>();
for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
{
if (entry.getKey().isAnnotationPresent(metaAnnotationType))
{
- s.add(entry.getValue());
+ annotations.add(entry.getValue());
}
}
- metaAnnotationMap.put(metaAnnotationType, s);
+ metaAnnotationMap.put(metaAnnotationType, annotations);
}
return metaAnnotationMap;
}
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 2008-11-26 22:23:32 UTC (rev 367)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-26 22:51:40 UTC (rev 368)
@@ -12,6 +12,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
@@ -22,25 +23,25 @@
* Base class for implementing AnnotatedItem.
*
* @author pmuir
- *
+ *
*/
public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
{
-
+
private Class<T> clazz;
private Type[] actualTypeArguments;
-
+
private Set<AnnotatedField<Object>> fields;
private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields;
private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields;
-
+
private Set<AnnotatedMethod<Object>> methods;
private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> annotatedMethods;
-
+
private Set<AnnotatedConstructor<T>> constructors;
private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> annotatedConstructors;
private Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
-
+
public AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations)
{
super(buildAnnotationMap(annotations));
@@ -54,22 +55,22 @@
actualTypeArguments = new Type[0];
}
}
-
+
public AnnotatedClassImpl(Class<T> clazz)
{
this(clazz, clazz, clazz.getAnnotations());
}
-
+
public Class<? extends T> getAnnotatedClass()
{
return clazz;
}
-
+
public Class<T> getDelegate()
{
return clazz;
}
-
+
public Set<AnnotatedField<Object>> getFields()
{
if (fields == null)
@@ -78,7 +79,7 @@
}
return fields;
}
-
+
public Set<AnnotatedConstructor<T>> getConstructors()
{
if (constructors == null)
@@ -87,22 +88,22 @@
}
return constructors;
}
-
+
private void initFields()
{
this.fields = new HashSet<AnnotatedField<Object>>();
- for(Class c=clazz;c!=Object.class;c=c.getSuperclass())
+ for (Class c = clazz; c != Object.class; c = c.getSuperclass())
{
- for(Field field : clazz.getDeclaredFields())
+ for (Field field : clazz.getDeclaredFields())
{
- if ( !field.isAccessible() ) field.setAccessible(true);
+ if (!field.isAccessible())
+ field.setAccessible(true);
fields.add(new AnnotatedFieldImpl<Object>(field, this));
}
}
}
- public Set<AnnotatedField<Object>> getMetaAnnotatedFields(
- Class<? extends Annotation> metaAnnotationType)
+ public Set<AnnotatedField<Object>> getMetaAnnotatedFields(Class<? extends Annotation> metaAnnotationType)
{
if (metaAnnotatedFields == null)
{
@@ -115,29 +116,25 @@
populateMetaAnnotatedFieldMap(metaAnnotationType, annotatedFields, metaAnnotatedFields);
return metaAnnotatedFields.get(metaAnnotationType);
}
-
- protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> populateMetaAnnotatedFieldMap(
- Class<T> metaAnnotationType,
- Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields,
- Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields)
+
+ protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> populateMetaAnnotatedFieldMap(Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields, Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields)
{
if (!metaAnnotatedFields.containsKey(metaAnnotationType))
{
- Set<AnnotatedField<Object>> s = new HashSet<AnnotatedField<Object>>();
- for (Class<? extends Annotation> annotationType: annotatedFields.keySet())
+ Set<AnnotatedField<Object>> fields = new HashSet<AnnotatedField<Object>>();
+ for (Entry<Class<? extends Annotation>, Set<AnnotatedField<Object>>> entry : annotatedFields.entrySet())
{
- if (annotationType.isAnnotationPresent(metaAnnotationType))
+ if (entry.getKey().isAnnotationPresent(metaAnnotationType))
{
- s.addAll(annotatedFields.get(annotationType));
+ fields.addAll(entry.getValue());
}
}
- metaAnnotatedFields.put(metaAnnotationType, s);
+ metaAnnotatedFields.put(metaAnnotationType, fields);
}
return metaAnnotatedFields;
}
- public Set<AnnotatedField<Object>> getAnnotatedFields(
- Class<? extends Annotation> annotationType)
+ public Set<AnnotatedField<Object>> getAnnotatedFields(Class<? extends Annotation> annotationType)
{
if (annotatedFields == null)
{
@@ -175,27 +172,28 @@
{
return actualTypeArguments;
}
-
+
private void initMethods()
{
this.methods = new HashSet<AnnotatedMethod<Object>>();
- for(Class c=clazz;c!=Object.class;c=c.getSuperclass())
+ for (Class c = clazz; c != Object.class; c = c.getSuperclass())
{
for (Method method : clazz.getDeclaredMethods())
{
- if (!method.isAccessible()) method.setAccessible(true);
+ if (!method.isAccessible())
+ method.setAccessible(true);
methods.add(new AnnotatedMethodImpl<Object>(method, this));
}
}
}
-
+
public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
{
if (annotatedMethods == null)
{
initAnnotatedMethods();
}
-
+
if (!annotatedMethods.containsKey(annotationType))
{
return new HashSet<AnnotatedMethod<Object>>();
@@ -225,7 +223,7 @@
}
}
}
-
+
private void initConstructors()
{
this.constructors = new HashSet<AnnotatedConstructor<T>>();
@@ -233,19 +231,20 @@
for (Constructor<?> constructor : clazz.getDeclaredConstructors())
{
AnnotatedConstructor<T> annotatedConstructor = new AnnotatedConstructorImpl<T>((Constructor<T>) constructor, this);
- if (!constructor.isAccessible()) constructor.setAccessible(true);
+ if (!constructor.isAccessible())
+ constructor.setAccessible(true);
constructors.add(annotatedConstructor);
constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
}
}
-
+
public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
{
if (annotatedConstructors == null)
{
initAnnotatedConstructors();
}
-
+
if (!annotatedConstructors.containsKey(annotationType))
{
return new HashSet<AnnotatedConstructor<T>>();
@@ -275,7 +274,7 @@
}
}
}
-
+
public AnnotatedConstructor<T> getConstructor(List<Class<?>> arguments)
{
return constructorsByArgumentMap.get(arguments);
16 years
[webbeans-commits] Webbeans SVN: r367 - in ri/trunk/webbeans-ri: src/main/java/org/jboss/webbeans/bean and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 17:23:32 -0500 (Wed, 26 Nov 2008)
New Revision: 367
Modified:
ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.ui.prefs
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
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/AnnotatedMethodImpl.java
Log:
Minor stuff
Modified: ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-11-26 22:23:32 UTC (rev 367)
@@ -1,5 +1,268 @@
-#Thu Nov 20 14:21:45 EST 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=3
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=3
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Modified: ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.ui.prefs 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.ui.prefs 2008-11-26 22:23:32 UTC (rev 367)
@@ -1,5 +1,5 @@
-#Tue Jun 24 10:21:10 BST 2008
-eclipse.preferences.version=1
-formatter_profile=_Web Beans
-formatter_settings_version=11
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
+#Thu Nov 20 10:11:13 EET 2008
+eclipse.preferences.version=1
+formatter_profile=_WebBeans
+formatter_settings_version=11
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-11-26 22:23:32 UTC (rev 367)
@@ -352,7 +352,7 @@
if (getAnnotatedItem().getMetaAnnotations(ScopeType.class).size() == 1)
{
this.scopeType = getAnnotatedItem().getMetaAnnotations(ScopeType.class).iterator().next().annotationType();
- log.trace("Scope " + scopeType + " specified b annotation");
+ log.trace("Scope " + scopeType + " specified by annotation");
return;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-26 22:23:32 UTC (rev 367)
@@ -69,7 +69,7 @@
for (AnnotatedMethod<Object> removeMethod : type.getAnnotatedMethods(REMOVE_ANNOTATION))
{
removeMethods.add(removeMethod);
- if (removeMethod.getParameters().size() == 0)
+ if (removeMethod.getDelegate().getParameterTypes().length == 0)
{
noArgsRemoveMethods.add(removeMethod);
}
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 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-26 22:23:32 UTC (rev 367)
@@ -92,15 +92,6 @@
return annotationMap;
}
- protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, AnnotationMap annotationMap)
- {
- for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
- {
- annotationSet.add(entry.getValue());
- }
- return annotationSet;
- }
-
protected static Object[] getParameterValues(List<AnnotatedParameter<Object>> parameters, ManagerImpl manager)
{
Object[] parameterValues = new Object[parameters.size()];
@@ -142,7 +133,8 @@
{
if (annotationSet == null)
{
- annotationSet = populateAnnotationSet(new HashSet<Annotation>(), annotationMap);
+ annotationSet = new HashSet<Annotation>();
+ annotationSet.addAll(annotationMap.values());
}
return annotationSet;
}
@@ -159,7 +151,7 @@
Set<Annotation> s = new HashSet<Annotation>();
for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
{
- if (entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
+ if (entry.getKey().isAnnotationPresent(metaAnnotationType))
{
s.add(entry.getValue());
}
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 2008-11-26 19:59:44 UTC (rev 366)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-11-26 22:23:32 UTC (rev 367)
@@ -18,7 +18,7 @@
public class AnnotatedMethodImpl<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
{
- private Type[] actualTypeArgements = new Type[0];
+ private Type[] actualTypeArguments = new Type[0];
private Method method;
@@ -36,7 +36,7 @@
this.declaringClass = declaringClass;
if (method.getGenericReturnType() instanceof ParameterizedType)
{
- actualTypeArgements = ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments();
+ actualTypeArguments = ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments();
}
}
@@ -57,7 +57,7 @@
public Type[] getActualTypeArguments()
{
- return actualTypeArgements;
+ return actualTypeArguments;
}
public List<AnnotatedParameter<Object>> getParameters()
16 years
[webbeans-commits] Webbeans SVN: r366 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 14:59:44 -0500 (Wed, 26 Nov 2008)
New Revision: 366
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/TransactionObservationPhase.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java
Log:
Transactional observer only watches single phase
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-11-26 14:12:53 UTC (rev 365)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-11-26 19:59:44 UTC (rev 366)
@@ -1,13 +1,14 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
import javax.webbeans.AfterTransactionCompletion;
import javax.webbeans.AfterTransactionFailure;
import javax.webbeans.AfterTransactionSuccess;
import javax.webbeans.BeforeTransactionCompletion;
+import javax.webbeans.DefinitionException;
import javax.webbeans.IfExists;
import javax.webbeans.Observer;
@@ -31,7 +32,7 @@
private EventBean<T> eventBean;
private final AnnotatedMethod<Object> observerMethod;
private final Class<T> eventType;
- private Set<TransactionObservationPhase> transactionObservationPhases;
+ private TransactionObservationPhase transactionObservationPhase;
private boolean conditional;
private ManagerImpl manager;
@@ -53,29 +54,41 @@
this.eventBean = eventBean;
this.observerMethod = observer;
this.eventType = eventType;
- initTransactionObservationPhases();
+ initTransactionObservationPhase();
conditional = !observerMethod.getAnnotatedParameters(IfExists.class).isEmpty();
}
- private void initTransactionObservationPhases()
+ private void initTransactionObservationPhase()
{
- transactionObservationPhases = new HashSet<TransactionObservationPhase>();
+ List<TransactionObservationPhase> observationPhases = new ArrayList<TransactionObservationPhase>();
if (observerMethod.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty())
{
- transactionObservationPhases.add(TransactionObservationPhase.BEFORE_COMPLETION);
+ observationPhases.add(TransactionObservationPhase.BEFORE_COMPLETION);
}
if (observerMethod.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty())
{
- transactionObservationPhases.add(TransactionObservationPhase.AFTER_COMPLETION);
+ observationPhases.add(TransactionObservationPhase.AFTER_COMPLETION);
}
if (observerMethod.getAnnotatedParameters(AfterTransactionFailure.class).isEmpty())
{
- transactionObservationPhases.add(TransactionObservationPhase.AFTER_FAILURE);
+ observationPhases.add(TransactionObservationPhase.AFTER_FAILURE);
}
if (observerMethod.getAnnotatedParameters(AfterTransactionSuccess.class).isEmpty())
{
- transactionObservationPhases.add(TransactionObservationPhase.AFTER_SUCCESS);
+ observationPhases.add(TransactionObservationPhase.AFTER_SUCCESS);
}
+ if (observationPhases.size() > 1)
+ {
+ throw new DefinitionException("Transactional observers can only observe on a single phase");
+ }
+ else if (observationPhases.size() == 1)
+ {
+ transactionObservationPhase = observationPhases.iterator().next();
+ }
+ else
+ {
+ transactionObservationPhase = TransactionObservationPhase.NONE;
+ }
}
/*
@@ -122,7 +135,7 @@
public boolean isTransactional()
{
- return !transactionObservationPhases.isEmpty();
+ return !TransactionObservationPhase.NONE.equals(transactionObservationPhase);
}
public boolean isConditional()
@@ -130,9 +143,9 @@
return conditional;
}
- public boolean isInterestedInTransactionPhase(TransactionObservationPhase transactionObservationPhase)
+ public boolean isInterestedInTransactionPhase(TransactionObservationPhase currentPhase)
{
- return transactionObservationPhases.contains(transactionObservationPhase);
+ return transactionObservationPhase.equals(currentPhase);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/TransactionObservationPhase.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/TransactionObservationPhase.java 2008-11-26 14:12:53 UTC (rev 365)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/TransactionObservationPhase.java 2008-11-26 19:59:44 UTC (rev 366)
@@ -2,5 +2,5 @@
public enum TransactionObservationPhase
{
- BEFORE_COMPLETION, AFTER_COMPLETION, AFTER_FAILURE, AFTER_SUCCESS
+ NONE, BEFORE_COMPLETION, AFTER_COMPLETION, AFTER_FAILURE, AFTER_SUCCESS
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-11-26 14:12:53 UTC (rev 365)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-11-26 19:59:44 UTC (rev 366)
@@ -209,6 +209,13 @@
}
@Test(groups={"stub", "events"})
+ @SpecAssertion(section="7.1")
+ public void testTransactionalObserverCanOnlyObserveSinglePhase()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "events"})
@SpecAssertion(section="7.5.6")
public void testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress()
{
16 years
[webbeans-commits] Webbeans SVN: r365 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 09:12:53 -0500 (Wed, 26 Nov 2008)
New Revision: 365
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java
Log:
minor: ArrayList -> CopyOnWriteArrayList in TransactionListener
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java 2008-11-26 12:47:44 UTC (rev 364)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java 2008-11-26 14:12:53 UTC (rev 365)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.transaction;
import java.rmi.RemoteException;
-import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import javax.ejb.EJBException;
import javax.ejb.Remove;
@@ -20,7 +20,7 @@
public class TransactionListener implements LocalTransactionListener, SessionSynchronization
{
- private List<Synchronization> synchronizations = new ArrayList<Synchronization>();
+ private List<Synchronization> synchronizations = new CopyOnWriteArrayList<Synchronization>();
public void afterBegin() throws EJBException, RemoteException
{
16 years
[webbeans-commits] Webbeans SVN: r364 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 07:47:44 -0500 (Wed, 26 Nov 2008)
New Revision: 364
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java
Log:
minor: don't handle contexts directly
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java 2008-11-26 07:10:49 UTC (rev 363)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java 2008-11-26 12:47:44 UTC (rev 364)
@@ -8,45 +8,34 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import javax.webbeans.manager.Manager;
+import javax.servlet.http.HttpServletRequest;
-import org.jboss.webbeans.contexts.AbstractContext;
-import org.jboss.webbeans.contexts.RequestContext;
-
-
/**
*
* @author Shane Bryzak
- *
+ *
*/
public class WebBeansFilter implements Filter
{
- private Manager container;
-
- public void init(FilterConfig filterConfig) throws ServletException
+ public void init(FilterConfig filterConfig) throws ServletException
{
-
+
}
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
- throws IOException, ServletException
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
- AbstractContext requestContext = new RequestContext();
-
try
{
- container.addContext(requestContext);
-
+ ServletLifecycle.beginRequest((HttpServletRequest) request);
chain.doFilter(request, response);
}
finally
{
- requestContext.destroy(container);
- }
+ ServletLifecycle.endRequest((HttpServletRequest) request);
+ }
}
- public void destroy()
+ public void destroy()
{
-
}
}
16 years
[webbeans-commits] Webbeans SVN: r363 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: introspector and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-11-26 02:10:49 -0500 (Wed, 26 Nov 2008)
New Revision: 363
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
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/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
Log:
Forwarding maps AnnotationMap and MetaAnnotationMap
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -23,7 +23,6 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.webbeans.BindingType;
@@ -44,6 +43,7 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -73,7 +73,7 @@
* @param possibleDeploymentTypes The possible deployment types
* @return The deployment type
*/
- public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
+ public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, AnnotationMap possibleDeploymentTypes)
{
for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -18,13 +18,12 @@
package org.jboss.webbeans.bean;
import java.lang.annotation.Annotation;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.model.StereotypeModel;
/**
@@ -35,7 +34,7 @@
*/
public class MergedStereotypes<T, E>
{
- private Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
+ private AnnotationMap possibleDeploymentTypes;
private Set<Annotation> possibleScopeTypes;
private boolean beanNameDefaulted;
private Set<Class<?>> requiredTypes;
@@ -49,7 +48,7 @@
*/
public MergedStereotypes(Set<Annotation> stereotypeAnnotations, ManagerImpl manager)
{
- possibleDeploymentTypes = new HashMap<Class<? extends Annotation>, Annotation>();
+ possibleDeploymentTypes = new AnnotationMap();
possibleScopeTypes = new HashSet<Annotation>();
requiredTypes = new HashSet<Class<?>>();
supportedScopes = new HashSet<Class<? extends Annotation>>();
@@ -94,7 +93,7 @@
*
* @return The deployment types
*/
- public Map<Class<? extends Annotation>, Annotation> getPossibleDeploymentTypes()
+ public AnnotationMap getPossibleDeploymentTypes()
{
return possibleDeploymentTypes;
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -30,7 +30,6 @@
*/
public interface AnnotatedItem<T, S>
{
-
/**
* Gets all annotations on the item
*
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 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -21,18 +21,54 @@
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Types;
+import com.google.common.collect.ForwardingMap;
+
public abstract class AbstractAnnotatedItem<T, S> implements AnnotatedItem<T, S>
{
- private static final Annotation[] DEFAULT_BINDING_ARRAY = {new CurrentAnnotationLiteral()};
+ public static class AnnotationMap extends ForwardingMap<Class<? extends Annotation>, Annotation>
+ {
+ private Map<Class<? extends Annotation>, Annotation> delegate;
+
+ public AnnotationMap()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Annotation>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Annotation> delegate()
+ {
+ return delegate;
+ }
+
+ }
+
+ public static class MetaAnnotationMap extends ForwardingMap<Class<? extends Annotation>, Set<Annotation>>
+ {
+ private Map<Class<? extends Annotation>, Set<Annotation>> delegate;
+
+ public MetaAnnotationMap()
+ {
+ delegate = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>, Set<Annotation>> delegate()
+ {
+ return delegate;
+ }
+
+ }
+
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentAnnotationLiteral() };
private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
-
- private Map<Class<? extends Annotation>, Annotation> annotationMap;
- private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotationMap;
+
+ private AnnotationMap annotationMap;
+ private MetaAnnotationMap metaAnnotationMap;
private Set<Annotation> annotationSet;
private Annotation[] annotationArray;
-
- public AbstractAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap)
+
+ public AbstractAnnotatedItem(AnnotationMap annotationMap)
{
if (annotationMap == null)
{
@@ -40,15 +76,15 @@
}
this.annotationMap = annotationMap;
}
-
- protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(AnnotatedElement element)
+
+ protected static AnnotationMap buildAnnotationMap(AnnotatedElement element)
{
return buildAnnotationMap(element.getAnnotations());
}
-
- protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Annotation[] annotations)
+
+ protected static AnnotationMap buildAnnotationMap(Annotation[] annotations)
{
- Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ AnnotationMap annotationMap = new AnnotationMap();
for (Annotation annotation : annotations)
{
annotationMap.put(annotation.annotationType(), annotation);
@@ -56,7 +92,7 @@
return annotationMap;
}
- protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, AnnotationMap annotationMap)
{
for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
{
@@ -64,11 +100,11 @@
}
return annotationSet;
}
-
+
protected static Object[] getParameterValues(List<AnnotatedParameter<Object>> parameters, ManagerImpl manager)
{
Object[] parameterValues = new Object[parameters.size()];
- Iterator<AnnotatedParameter<Object>> iterator = parameters.iterator();
+ Iterator<AnnotatedParameter<Object>> iterator = parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
parameterValues[i] = iterator.next().getValue(manager);
@@ -76,6 +112,7 @@
return parameterValues;
}
+ @SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
{
return (A) annotationMap.get(annotationType);
@@ -85,12 +122,12 @@
{
if (metaAnnotationMap == null)
{
- metaAnnotationMap = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
+ metaAnnotationMap = new MetaAnnotationMap();
}
metaAnnotationMap = populateMetaAnnotationMap(metaAnnotationType, metaAnnotationMap, annotationMap);
return metaAnnotationMap.get(metaAnnotationType);
}
-
+
public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
{
if (annotationArray == null)
@@ -115,10 +152,7 @@
return annotationMap.containsKey(annotatedType);
}
- protected static <A extends Annotation> Map<Class<? extends Annotation>, Set<Annotation>> populateMetaAnnotationMap(
- Class<A> metaAnnotationType, Map<Class<? extends Annotation>,
- Set<Annotation>> metaAnnotationMap,
- Map<Class<? extends Annotation>, Annotation> annotationMap)
+ protected static <A extends Annotation> MetaAnnotationMap populateMetaAnnotationMap(Class<A> metaAnnotationType, MetaAnnotationMap metaAnnotationMap, AnnotationMap annotationMap)
{
if (!metaAnnotationMap.containsKey(metaAnnotationType))
{
@@ -135,11 +169,11 @@
return metaAnnotationMap;
}
- protected Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
+ protected AnnotationMap getAnnotationMap()
{
return annotationMap;
}
-
+
@Override
public boolean equals(Object other)
{
@@ -150,12 +184,12 @@
}
return false;
}
-
+
public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
{
return isAssignableFrom(that.getType(), that.getActualTypeArguments());
}
-
+
public boolean isAssignableFrom(Set<Class<?>> types)
{
for (Class<?> type : types)
@@ -167,18 +201,18 @@
}
return false;
}
-
+
private boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
{
return Types.boxedType(getType()).isAssignableFrom(Types.boxedType(type)) && Arrays.equals(getActualTypeArguments(), actualTypeArguments);
}
-
+
@Override
public int hashCode()
{
return getType().hashCode();
}
-
+
@Override
public String toString()
{
@@ -199,7 +233,7 @@
string += getAnnotations();
return string;
}
-
+
public Set<Annotation> getBindingTypes()
{
if (getMetaAnnotations(BindingType.class).size() > 0)
@@ -211,7 +245,7 @@
return DEFAULT_BINDING;
}
}
-
+
public Annotation[] getBindingTypesAsArray()
{
if (getMetaAnnotationsAsArray(BindingType.class).length > 0)
@@ -223,7 +257,7 @@
return DEFAULT_BINDING_ARRAY;
}
}
-
+
public boolean isProxyable()
{
if (Reflections.getConstructor(getType()) == null)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -1,8 +1,6 @@
package org.jboss.webbeans.introspector.jlr;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
-import java.util.Map;
import javax.webbeans.BindingType;
@@ -14,7 +12,7 @@
private String name;
- public AbstractAnnotatedMember(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ public AbstractAnnotatedMember(AnnotationMap annotationMap)
{
super(annotationMap);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.introspector.jlr;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.util.Reflections;
@@ -11,7 +8,7 @@
private AnnotatedClass<Object> superclass;
- public AbstractAnnotatedType(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ public AbstractAnnotatedType(AnnotationMap annotationMap)
{
super(annotationMap);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-11-25 19:47:31 UTC (rev 362)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-11-26 07:10:49 UTC (rev 363)
@@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.Map;
import javax.webbeans.TypeLiteral;
@@ -14,18 +13,18 @@
private Class<T> type;
private Annotation[] actualAnnotations;
- private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ private AnnotatedItemImpl(AnnotationMap annotationMap)
{
super(annotationMap);
}
- private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type)
+ private AnnotatedItemImpl(AnnotationMap annotationMap, Class<T> type)
{
super(annotationMap);
this.type = type;
}
- private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, TypeLiteral<T> apiType)
+ private AnnotatedItemImpl(AnnotationMap annotationMap, TypeLiteral<T> apiType)
{
super(annotationMap);
this.type = apiType.getRawType();
@@ -35,7 +34,7 @@
}
}
- private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type, Type[] actualTypeArguments)
+ private AnnotatedItemImpl(AnnotationMap annotationMap, Class<T> type, Type[] actualTypeArguments)
{
this(annotationMap, type);
this.actualTypeArguments = actualTypeArguments;
16 years