Skip to content

Commit

Permalink
Injection of superclasses
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1087 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Jan 19, 2009
1 parent b9715e3 commit a283e5c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 45 deletions.
Expand Up @@ -34,6 +34,7 @@
import javax.webbeans.ScopeType;

import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.injection.InjectionPointProvider;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
Expand Down Expand Up @@ -85,6 +86,28 @@ protected void init()
// TODO Interceptors
initInitializerMethods();
}

/**
* Injects bound fields
*
* @param instance The instance to inject into
*/
protected void injectBoundFields(T instance)
{
InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
for (AnnotatedField<?> injectableField : getInjectableFields())
{
injectionPointProvider.pushInjectionPoint(injectableField);
try
{
injectableField.inject(instance, manager);
}
finally
{
injectionPointProvider.popInjectionPoint();
}
}
}

/**
* Initializes the bean type
Expand Down
Expand Up @@ -44,7 +44,6 @@
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
Expand Down Expand Up @@ -372,27 +371,6 @@ protected void injectEjbAndCommonFields()
// TODO Support commons and EJB annotations
}

/**
* Injects bound fields
*
* @param instance The bean instance
*/
protected void injectBoundFields(T instance)
{
for (AnnotatedField<?> field : getInjectableFields())
{
try
{
manager.getInjectionPointProvider().pushInjectionPoint(field);
field.inject(instance, manager);
}
finally
{
manager.getInjectionPointProvider().popInjectionPoint();
}
}
}

/**
* Gets the specializes type of the bean
*
Expand Down
22 changes: 0 additions & 22 deletions webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
Expand Up @@ -267,28 +267,6 @@ protected void injectEjbAndCommonFields(T beanInstance)

}

/**
* Injects bound fields
*
* @param instance The instance to inject into
*/
protected void injectBoundFields(T instance)
{
InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
for (AnnotatedField<?> injectableField : getInjectableFields())
{
injectionPointProvider.pushInjectionPoint(injectableField);
try
{
injectableField.inject(instance, manager);
}
finally
{
injectionPointProvider.popInjectionPoint();
}
}
}

/**
* Initializes the bean and its metadata
*/
Expand Down
Expand Up @@ -278,7 +278,7 @@ private AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations
this.metaAnnotatedFields = new AnnotatedFieldMap();
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
for (Field field : clazz.getDeclaredFields())
for (Field field : c.getDeclaredFields())
{
if (!field.isAccessible())
{
Expand Down

0 comments on commit a283e5c

Please sign in to comment.