Weld SVN: r6029 - extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-09 18:02:27 -0500 (Tue, 09 Mar 2010)
New Revision: 6029
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java
Log:
basic code quality
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java 2010-03-09 22:55:58 UTC (rev 6028)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java 2010-03-09 23:02:27 UTC (rev 6029)
@@ -15,5 +15,5 @@
@Target( { ElementType.TYPE })
public @interface Generic
{
- Class value();
+ Class<?> value();
}
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java 2010-03-09 22:55:58 UTC (rev 6028)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java 2010-03-09 23:02:27 UTC (rev 6029)
@@ -22,9 +22,22 @@
*/
public class GenericBeanInjectionTargetWrapper<T> implements InjectionTarget<T>
{
- InjectionTarget<T> delegate;
- Annotation annotation;
- ReannotatedType<T> annotatedType;
+
+ private static Set<Field> getFields(Class<?> clazz)
+ {
+ Set<Field> fields = new HashSet<Field>();
+ fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
+ Class<?> superClass = clazz.getSuperclass();
+ if (superClass != Object.class)
+ {
+ fields.addAll(getFields(superClass));
+ }
+ return fields;
+ }
+
+ private final InjectionTarget<T> delegate;
+ private final Annotation annotation;
+ private final ReannotatedType<T> annotatedType;
public GenericBeanInjectionTargetWrapper(ReannotatedType<T> annotatedType, InjectionTarget<T> delegate, Annotation annotation)
{
@@ -84,21 +97,4 @@
return delegate.produce(ctx);
}
- public static Set<Field> getFields(Class clazz)
- {
- Set<Field> ret = new HashSet<Field>();
- return getFields(clazz, ret);
- }
-
- private static Set<Field> getFields(Class clazz, Set<Field> ret)
- {
- ret.addAll(Arrays.asList(clazz.getDeclaredFields()));
- Class n = clazz.getSuperclass();
- if (n != Object.class)
- {
- return getFields(n);
- }
- return ret;
- }
-
}
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java 2010-03-09 22:55:58 UTC (rev 6028)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java 2010-03-09 23:02:27 UTC (rev 6029)
@@ -28,31 +28,31 @@
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
+import org.jboss.weld.extensions.beans.CustomBeanBuilder;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
import org.jboss.weld.extensions.util.reannotated.ReannotatedField;
import org.jboss.weld.extensions.util.reannotated.ReannotatedParameter;
import org.jboss.weld.extensions.util.reannotated.ReannotatedType;
-import org.jboss.weld.extensions.beans.CustomBeanBuilder;
public class GenericExtension implements Extension
{
- AnnotationInstanceProvider annotationProvider = new AnnotationInstanceProvider();
+ private AnnotationInstanceProvider annotationProvider = new AnnotationInstanceProvider();
- Map<Class<?>, Set<AnnotatedType<?>>> genericBeans = new HashMap<Class<?>, Set<AnnotatedType<?>>>();
+ private Map<Class<?>, Set<AnnotatedType<?>>> genericBeans = new HashMap<Class<?>, Set<AnnotatedType<?>>>();
- Map<Class<?>, Map<AnnotatedField<?>, Annotation>> producerFields = new HashMap<Class<?>, Map<AnnotatedField<?>, Annotation>>();
+ private Map<Class<?>, Map<AnnotatedField<?>, Annotation>> producerFields = new HashMap<Class<?>, Map<AnnotatedField<?>, Annotation>>();
/**
* map of a generic annotation type to all instances of that type found on
* beans
*/
- Map<Class<?>, Set<Annotation>> concreteGenerics = new HashMap<Class<?>, Set<Annotation>>();
+ private Map<Class<?>, Set<Annotation>> concreteGenerics = new HashMap<Class<?>, Set<Annotation>>();
/**
* Map of generic Annotation instance to a SyntheticQualifier
*/
- Map<Annotation, SyntheticQualifier> qualifierMap = new HashMap<Annotation, SyntheticQualifier>();
+ private Map<Annotation, SyntheticQualifier> qualifierMap = new HashMap<Annotation, SyntheticQualifier>();
long count = 0;
@@ -107,7 +107,7 @@
*/
public <T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> event, BeanManager beanManager)
{
- Class javaClass = event.getAnnotatedType().getJavaClass();
+ Class<?> javaClass = event.getAnnotatedType().getJavaClass();
if (producerFields.containsKey(javaClass))
{
Map<AnnotatedField<?>, Annotation> producers = producerFields.get(javaClass);
@@ -184,7 +184,7 @@
{
ReannotatedParameter<?> param = (ReannotatedParameter<?>) pm;
- Class paramType = m.getJavaMember().getParameterTypes()[param.getPosition()];
+ Class<?> paramType = m.getJavaMember().getParameterTypes()[param.getPosition()];
//check to see if we should be injecting a generic bean
//we do this by checking if there are any beans that can be injected into this point
@@ -235,7 +235,7 @@
{
if (!qualifierMap.containsKey(a))
{
- SyntheticQualifier qualifier = (SyntheticQualifier) annotationProvider.get(SyntheticQualifier.class, (Map) Collections.singletonMap("value", count++));
+ SyntheticQualifier qualifier = annotationProvider.get(SyntheticQualifier.class, (Map) Collections.singletonMap("value", count++));
qualifierMap.put(a, qualifier);
}
return qualifierMap.get(a);
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java 2010-03-09 22:55:58 UTC (rev 6028)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java 2010-03-09 23:02:27 UTC (rev 6029)
@@ -16,8 +16,8 @@
*/
public class ProducerFieldInjectionTarget<T> implements InjectionTarget<T>
{
- final InjectionTarget<T> delegate;
- final List<FieldSetter> fieldSetters;
+ private final InjectionTarget<T> delegate;
+ private final List<FieldSetter> fieldSetters;
public ProducerFieldInjectionTarget(InjectionTarget<T> delegate, List<FieldSetter> fieldSetters)
{