Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Jan 12, 2010
1 parent 301e2a5 commit 0182ca3
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 115 deletions.
8 changes: 4 additions & 4 deletions impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
Expand Up @@ -86,12 +86,12 @@ public abstract class AbstractBean<T, S> extends RIBean<T>
/**
* Constructor
*
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
public AbstractBean(String idSuffix, BeanManagerImpl manager)
public AbstractBean(String idSuffix, BeanManagerImpl beanManager)
{
super(idSuffix, manager);
this.beanManager = manager;
super(idSuffix, beanManager);
this.beanManager = beanManager;
this.injectionPoints = new HashSet<WeldInjectionPoint<?, ?>>();
this.delegateInjectionPoints = new HashSet<WeldInjectionPoint<?,?>>();
this.newInjectionPoints = new HashSet<WeldInjectionPoint<?,?>>();
Expand Down
18 changes: 9 additions & 9 deletions impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
Expand Up @@ -94,19 +94,19 @@ public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>>
* Extracts the complete set of interception bindings from a given set of
* annotations.
*
* @param manager
* @param beanManager
* @param annotations
* @return
*/
protected static Set<Annotation> flattenInterceptorBindings(BeanManagerImpl manager, Set<Annotation> annotations)
protected static Set<Annotation> flattenInterceptorBindings(BeanManagerImpl beanManager, Set<Annotation> annotations)
{
Set<Annotation> foundInterceptionBindingTypes = new HashSet<Annotation>();
for (Annotation annotation : annotations)
{
if (manager.isInterceptorBinding(annotation.annotationType()))
if (beanManager.isInterceptorBinding(annotation.annotationType()))
{
foundInterceptionBindingTypes.add(annotation);
foundInterceptionBindingTypes.addAll(manager.getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(annotation.annotationType()).getInheritedInterceptionBindingTypes());
foundInterceptionBindingTypes.addAll(beanManager.getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(annotation.annotationType()).getInheritedInterceptionBindingTypes());
}
}
return foundInterceptionBindingTypes;
Expand Down Expand Up @@ -158,11 +158,11 @@ private static SerializableContextual[] toSerializableContextualArray(List<Inter
* Constructor
*
* @param type The type
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
protected AbstractClassBean(WeldClass<T> type, String idSuffix, BeanManagerImpl manager)
protected AbstractClassBean(WeldClass<T> type, String idSuffix, BeanManagerImpl beanManager)
{
super(idSuffix, manager);
super(idSuffix, beanManager);
this.annotatedItem = type;
this.decoratorStackPosition = new ThreadLocal<Integer>()
{
Expand Down Expand Up @@ -214,7 +214,7 @@ public void checkType()

public void initDecorators()
{
this.decorators = getManager().resolveDecorators(getTypes(), getQualifiers());
this.decorators = getBeanManager().resolveDecorators(getTypes(), getQualifiers());
}

public boolean hasDecorators()
Expand Down Expand Up @@ -245,7 +245,7 @@ protected T applyDecorators(T instance, CreationalContext<T> creationalContext,
Decorator<?> decorator = decorators.get(i);
decoratorStackPosition.set(++i);

Object decoratorInstance = getManager().getReference(ip, decorator, creationalContext);
Object decoratorInstance = getBeanManager().getReference(ip, decorator, creationalContext);
decoratorInstances.add(new SerializableContextualInstanceImpl<Decorator<Object>, Object>((Decorator<Object>) decorator, decoratorInstance, null));

ip = Beans.getDelegateInjectionPoint(decorator);
Expand Down
Expand Up @@ -96,11 +96,11 @@ public abstract class AbstractProducerBean<X, T, S extends Member> extends Abstr
* Constructor
*
* @param declaringBean The declaring bean
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
public AbstractProducerBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
public AbstractProducerBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl beanManager)
{
super(idSuffix, declaringBean, manager);
super(idSuffix, declaringBean, beanManager);
serializationCheckCache = new ConcurrentCache<Class<?>, Boolean>();
}

Expand Down
Expand Up @@ -42,9 +42,9 @@ public abstract class AbstractReceiverBean<X, T, S extends Member> extends Abstr

private AbstractClassBean<X> declaringBean;

public AbstractReceiverBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
public AbstractReceiverBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl beanManager)
{
super(idSuffix, manager);
super(idSuffix, beanManager);
this.declaringBean = declaringBean;
}

Expand Down
28 changes: 13 additions & 15 deletions impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
Expand Up @@ -58,12 +58,7 @@

public class DecoratorImpl<T> extends ManagedBean<T> implements WeldDecorator<T>
{
private WeldClass<?> annotatedDelegateItem;

private WeldClass<T> proxyClassForAbstractDecorators;
private WeldConstructor<T> constructorForAbstractDecorator;

private Set<MethodSignature> decoratedMethodSignatures;


public static <T> Decorator<T> wrap(final Decorator<T> decorator)
{
Expand Down Expand Up @@ -96,24 +91,27 @@ protected Decorator<T> delegate()
*
* @param <T> The type
* @param clazz The class
* @param manager the current manager
* @param beanManager the current manager
* @return a Bean
*/
public static <T> DecoratorImpl<T> of(WeldClass<T> clazz, BeanManagerImpl manager)
public static <T> DecoratorImpl<T> of(WeldClass<T> clazz, BeanManagerImpl beanManager)
{
return new DecoratorImpl<T>(clazz, manager);
return new DecoratorImpl<T>(clazz, beanManager);
}


private WeldClass<?> annotatedDelegateItem;
private WeldClass<T> proxyClassForAbstractDecorators;
private WeldConstructor<T> constructorForAbstractDecorator;
private Set<MethodSignature> decoratedMethodSignatures;
private WeldInjectionPoint<?, ?> delegateInjectionPoint;
private Set<Annotation> delegateBindings;
private Type delegateType;
private Set<Type> delegateTypes;
private Set<Type> decoratedTypes;
private HashSet<WeldClass<?>> annotatedDecoratedTypes;

protected DecoratorImpl(WeldClass<T> type, BeanManagerImpl manager)
protected DecoratorImpl(WeldClass<T> type, BeanManagerImpl beanManager)
{
super(type, new StringBuilder().append(Decorator.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), manager);
super(type, new StringBuilder().append(Decorator.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), beanManager);
}

@Override
Expand All @@ -137,7 +135,7 @@ protected void initDecoratedTypes()
this.decoratedTypes.addAll(getWeldAnnotated().getInterfaceClosure());
this.decoratedTypes.remove(Serializable.class);

this.decoratedMethodSignatures = Deployers.getDecoratedMethodSignatures(getManager(), this.decoratedTypes);
this.decoratedMethodSignatures = Deployers.getDecoratedMethodSignatures(getBeanManager(), this.decoratedTypes);
}

protected void initDelegateInjectionPoint()
Expand Down Expand Up @@ -216,7 +214,7 @@ private void checkAbstractMethods()
{
for(WeldMethod<?,?> method: getWeldAnnotated().getWeldMethods())
{
if (Reflections.isAbstract(((AnnotatedMethod) method).getJavaMember()))
if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember()))
{
MethodSignature methodSignature = method.getSignature();
if (this.annotatedDelegateItem.getWeldMethod(methodSignature) == null)
Expand Down
5 changes: 2 additions & 3 deletions impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
Expand Up @@ -47,12 +47,11 @@ public class DisposalMethod<X, T> extends AbstractReceiverBean<X, T, Method>
{

protected MethodInjectionPoint<T, X> disposalMethodInjectionPoint;

private WeldParameter<?, X> disposesParameter;

protected DisposalMethod(BeanManagerImpl manager, WeldMethod<T, X> disposalMethod, AbstractClassBean<X> declaringBean)
protected DisposalMethod(BeanManagerImpl beanManager, WeldMethod<T, X> disposalMethod, AbstractClassBean<X> declaringBean)
{
super(new StringBuilder().append(DisposalMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getWeldAnnotated().getName()).append(disposalMethod.getSignature().toString()).toString(), declaringBean, manager);
super(new StringBuilder().append(DisposalMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getWeldAnnotated().getName()).append(disposalMethod.getSignature().toString()).toString(), declaringBean, beanManager);
this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
initQualifiers();
initType();
Expand Down
20 changes: 10 additions & 10 deletions impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
Expand Up @@ -48,33 +48,33 @@ public class InterceptorImpl<T> extends ManagedBean<T> implements Interceptor<T>
private final Set<Annotation> interceptorBindingTypes;

private final boolean serializable;

public static <T> InterceptorImpl<T> of(WeldClass<T> type, BeanManagerImpl beanManager)
{
return new InterceptorImpl<T>(type, beanManager);
}

protected InterceptorImpl(WeldClass<T> type, BeanManagerImpl manager)
protected InterceptorImpl(WeldClass<T> type, BeanManagerImpl beanManager)
{
super(type, new StringBuilder().append(Interceptor.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), manager);
super(type, new StringBuilder().append(Interceptor.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), beanManager);
this.interceptorClassMetadata = InterceptorClassMetadataRegistry.getRegistry().getInterceptorClassMetadata(type.getJavaClass());
this.serializable = type.isSerializable();
this.interceptorBindingTypes = new HashSet<Annotation>();
interceptorBindingTypes.addAll(flattenInterceptorBindings(manager, getWeldAnnotated().getAnnotations()));
interceptorBindingTypes.addAll(flattenInterceptorBindings(beanManager, getWeldAnnotated().getAnnotations()));
for (Class<? extends Annotation> annotation : getStereotypes())
{
interceptorBindingTypes.addAll(flattenInterceptorBindings(manager, manager.getStereotypeDefinition(annotation)));
interceptorBindingTypes.addAll(flattenInterceptorBindings(beanManager, beanManager.getStereotypeDefinition(annotation)));
}
if (this.interceptorBindingTypes.size() == 0)
{
throw new DeploymentException(MISSING_BINDING_ON_INTERCEPTOR, type.getName());
}
if (Beans.findInterceptorBindingConflicts(manager, interceptorBindingTypes))
if (Beans.findInterceptorBindingConflicts(beanManager, interceptorBindingTypes))
{
throw new DeploymentException(CONFLICTING_INTERCEPTOR_BINDINGS, getType());
}
}

public static <T> InterceptorImpl<T> of(WeldClass<T> type, BeanManagerImpl manager)
{
return new InterceptorImpl<T>(type, manager);
}

public Set<Annotation> getInterceptorBindings()
{
return interceptorBindingTypes;
Expand Down
32 changes: 16 additions & 16 deletions impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
Expand Up @@ -95,12 +95,12 @@ public class ManagedBean<T> extends AbstractClassBean<T>
*
* @param <T> The type
* @param clazz The class
* @param manager the current manager
* @param beanManager the current manager
* @return A Web Bean
*/
public static <T> ManagedBean<T> of(WeldClass<T> clazz, BeanManagerImpl manager)
public static <T> ManagedBean<T> of(WeldClass<T> clazz, BeanManagerImpl beanManager)
{
return new ManagedBean<T>(clazz, createId(ManagedBean.class.getSimpleName(), clazz), manager);
return new ManagedBean<T>(clazz, createId(ManagedBean.class.getSimpleName(), clazz), beanManager);
}

protected static String createId(String beanType, WeldClass<?> clazz)
Expand All @@ -112,11 +112,11 @@ protected static String createId(String beanType, WeldClass<?> clazz)
* Constructor
*
* @param type The type of the bean
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
protected ManagedBean(WeldClass<T> type, String idSuffix, BeanManagerImpl manager)
protected ManagedBean(WeldClass<T> type, String idSuffix, BeanManagerImpl beanManager)
{
super(type, idSuffix, manager);
super(type, idSuffix, beanManager);
initType();
initTypes();
initQualifiers();
Expand Down Expand Up @@ -144,7 +144,7 @@ protected InjectionPoint attachCorrectInjectionPoint()
{
throw new ForbiddenStateException(DELEGATE_INJECTION_POINT_NOT_FOUND, decorator);
}
return getManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
return getBeanManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
}

/**
Expand Down Expand Up @@ -189,13 +189,13 @@ public void initialize(BeanDeployerEnvironment environment)

public void inject(final T instance, final CreationalContext<T> ctx)
{
new InjectionContextImpl<T>(getManager(), this, instance)
new InjectionContextImpl<T>(getBeanManager(), this, instance)
{

public void proceed()
{
Beans.injectEEFields(instance, getManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
Beans.injectFieldsAndInitializers(instance, ctx, getManager(), getInjectableFields(), getInitializerMethods());
Beans.injectEEFields(instance, getBeanManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
Beans.injectFieldsAndInitializers(instance, ctx, getBeanManager(), getInjectableFields(), getInitializerMethods());
}

}.run();
Expand Down Expand Up @@ -285,7 +285,7 @@ public void initializeAfterBeanDiscovery()
}
if (this.passivationCapableBean && hasCdiBoundInterceptors())
{
for (SerializableContextual<Interceptor<?>, ?> interceptor : getManager().getCdiInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors())
for (SerializableContextual<Interceptor<?>, ?> interceptor : getBeanManager().getCdiInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors())
{
if (!(PassivationCapable.class.isAssignableFrom(interceptor.get().getClass())) || !((InterceptorImpl<?>)interceptor.get()).isSerializable())
{
Expand All @@ -296,7 +296,7 @@ public void initializeAfterBeanDiscovery()
}
if (this.passivationCapableBean && hasDirectlyDefinedInterceptors())
{
for (Class<?> interceptorClass : getManager().getClassDeclaredInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors())
for (Class<?> interceptorClass : getBeanManager().getClassDeclaredInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors())
{
if (!Reflections.isSerializable(interceptorClass))
{
Expand Down Expand Up @@ -338,9 +338,9 @@ public boolean isPassivationCapableDependency()

private void initEEInjectionPoints()
{
this.ejbInjectionPoints = Beans.getEjbInjectionPoints(this, getWeldAnnotated(), getManager());
this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(this, getWeldAnnotated(), getManager());
this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(this, getWeldAnnotated(), getManager());
this.ejbInjectionPoints = Beans.getEjbInjectionPoints(this, getWeldAnnotated(), getBeanManager());
this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(this, getWeldAnnotated(), getBeanManager());
this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(this, getWeldAnnotated(), getBeanManager());
this.resourceInjectionPoints = Beans.getResourceInjectionPoints(this, getWeldAnnotated(), beanManager);
}

Expand Down Expand Up @@ -465,7 +465,7 @@ protected T applyInterceptors(T instance, final CreationalContext<T> creationalC
if (hasDirectlyDefinedInterceptors())
{
interceptionRegistries.add(beanManager.getClassDeclaredInterceptorsRegistry());
interceptionHandlerFactories.add(new ClassInterceptionHandlerFactory(creationalContext, getManager()));
interceptionHandlerFactories.add(new ClassInterceptionHandlerFactory(creationalContext, getBeanManager()));
}
if (hasCdiBoundInterceptors())
{
Expand Down
12 changes: 6 additions & 6 deletions impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java
Expand Up @@ -38,12 +38,12 @@ public class NewManagedBean<T> extends ManagedBean<T> implements NewBean
* Creates an instance of a NewSimpleBean from an annotated class
*
* @param clazz The annotated class
* @param manager The Bean manager
* @param beanManager The Bean manager
* @return a new NewSimpleBean instance
*/
public static <T> NewManagedBean<T> of(WeldClass<T> clazz, BeanManagerImpl manager)
public static <T> NewManagedBean<T> of(WeldClass<T> clazz, BeanManagerImpl beanManager)
{
return new NewManagedBean<T>(clazz, createId(NewManagedBean.class.getSimpleName(), clazz), manager);
return new NewManagedBean<T>(clazz, createId(NewManagedBean.class.getSimpleName(), clazz), beanManager);
}

private Set<Annotation> bindings;
Expand All @@ -52,11 +52,11 @@ public static <T> NewManagedBean<T> of(WeldClass<T> clazz, BeanManagerImpl manag
* Protected constructor
*
* @param type An annotated class
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
protected NewManagedBean(final WeldClass<T> type, String idSuffix, BeanManagerImpl manager)
protected NewManagedBean(final WeldClass<T> type, String idSuffix, BeanManagerImpl beanManager)
{
super(type, idSuffix, manager);
super(type, idSuffix, beanManager);
this.bindings = new HashSet<Annotation>();
this.bindings.add(new NewLiteral()
{
Expand Down
14 changes: 7 additions & 7 deletions impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java
Expand Up @@ -40,13 +40,13 @@ public class NewSessionBean<T> extends SessionBean<T> implements NewBean
* Creates an instance of a NewEnterpriseBean from an annotated class
*
* @param clazz The annotated class
* @param manager The Bean manager
* @param beanManager The Bean manager
* @return a new NewEnterpriseBean instance
*/
public static <T> NewSessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
public static <T> NewSessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager)
{
WeldClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
return new NewSessionBean<T>(type, ejbDescriptor, createId(NewSessionBean.class.getSimpleName(), ejbDescriptor), manager);
WeldClass<T> type = beanManager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
return new NewSessionBean<T>(type, ejbDescriptor, createId(NewSessionBean.class.getSimpleName(), ejbDescriptor), beanManager);
}

private Set<Annotation> bindings;
Expand All @@ -55,11 +55,11 @@ public static <T> NewSessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, B
* Protected constructor
*
* @param type An annotated class
* @param manager The Bean manager
* @param beanManager The Bean manager
*/
protected NewSessionBean(final WeldClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, String idSuffix, BeanManagerImpl manager)
protected NewSessionBean(final WeldClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, String idSuffix, BeanManagerImpl beanManager)
{
super(type, ejbDescriptor, idSuffix, manager);
super(type, ejbDescriptor, idSuffix, beanManager);
this.bindings = new HashSet<Annotation>();
this.bindings.add(new NewLiteral()
{
Expand Down

0 comments on commit 0182ca3

Please sign in to comment.