Skip to content

Commit

Permalink
WELD-1816 Cache whether an InjectionPoint is a @DeleGate or not
Browse files Browse the repository at this point in the history
  • Loading branch information
jharting committed Dec 15, 2014
1 parent f18eb1b commit def9af3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -25,6 +25,7 @@
import javax.decorator.Delegate;
import javax.enterprise.inject.spi.Bean;

import org.jboss.weld.annotated.enhanced.EnhancedAnnotated;
import org.jboss.weld.serialization.BeanHolder;
import org.jboss.weld.util.reflection.HierarchyDiscovery;
import org.jboss.weld.util.reflection.Reflections;
Expand All @@ -38,15 +39,17 @@ public abstract class AbstractInferringInjectionPointAttributes<T, S> implements
private final BeanHolder<?> bean;
private final Set<Annotation> qualifiers;
private final TypeAttribute typeAttribute;
private final boolean delegate;

public AbstractInferringInjectionPointAttributes(String contextId, Bean<?> bean, Set<Annotation> qualifiers, Class<?> declaringComponentClass) {
public AbstractInferringInjectionPointAttributes(EnhancedAnnotated<?, ?> annotatedElement, String contextId, Bean<?> bean, Set<Annotation> qualifiers, Class<?> declaringComponentClass) {
this.bean = BeanHolder.of(contextId, bean);
this.qualifiers = qualifiers;
if (bean == null) {
this.typeAttribute = new NonContextualInjectionPointTypeAttribute(declaringComponentClass);
} else {
this.typeAttribute = new BeanInjectionPointTypeAttribute();
}
this.delegate = annotatedElement.isAnnotationPresent(Delegate.class);
}

@Override
Expand All @@ -66,7 +69,7 @@ public Bean<?> getBean() {

@Override
public boolean isDelegate() {
return getAnnotated().isAnnotationPresent(Delegate.class);
return delegate;
}

@Override
Expand Down
Expand Up @@ -44,7 +44,7 @@ public static <T, X> InferringFieldInjectionPointAttributes<T, X> of(EnhancedAnn
private final AnnotatedField<X> field;

protected InferringFieldInjectionPointAttributes(EnhancedAnnotatedField<T, X> field, Bean<?> bean, Class<?> declaringComponentClass, BeanManagerImpl manager) {
super(manager.getContextId(), bean, SharedObjectCache.instance(manager).getSharedSet(field.getQualifiers()), declaringComponentClass);
super(field, manager.getContextId(), bean, SharedObjectCache.instance(manager).getSharedSet(field.getQualifiers()), declaringComponentClass);
this.field = field.slim();
}

Expand Down
Expand Up @@ -44,7 +44,7 @@ public static <T, X> InferringParameterInjectionPointAttributes<T, X> of(Enhance
private final AnnotatedParameter<X> parameter;

protected InferringParameterInjectionPointAttributes(EnhancedAnnotatedParameter<T, X> parameter, Bean<?> bean, Class<?> declaringComponentClass, BeanManagerImpl manager) {
super(manager.getContextId(), bean, SharedObjectCache.instance(manager).getSharedSet(parameter.getQualifiers()), declaringComponentClass);
super(parameter, manager.getContextId(), bean, SharedObjectCache.instance(manager).getSharedSet(parameter.getQualifiers()), declaringComponentClass);
this.parameter = parameter.slim();
}

Expand Down

0 comments on commit def9af3

Please sign in to comment.