Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.rebind.ioc.injector.basic
Class QualifiedTypeInjectorDelegate

java.lang.Object
  extended by org.jboss.errai.ioc.rebind.ioc.injector.AbstractInjector
      extended by org.jboss.errai.ioc.rebind.ioc.injector.basic.QualifiedTypeInjectorDelegate
All Implemented Interfaces:
Injector
Direct Known Subclasses:
AsyncQualifiedTypeInjectorDelegate

public class QualifiedTypeInjectorDelegate
extends AbstractInjector

This injector wraps another injector to create qualifying references based on type parameters and qualifiers to the underlying bean. For instance if two beans implement a common interface, with two different type parameters, each bean will be wrapped in this injector and added as common injectors to the interface.

Author:
Mike Brock

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.errai.ioc.rebind.ioc.injector.AbstractInjector
AbstractInjector.RegisterCache
 
Field Summary
protected  Injector delegate
           
protected  MetaClass type
           
 
Fields inherited from class org.jboss.errai.ioc.rebind.ioc.injector.AbstractInjector
_registerCache, alternative, attributes, basic, beanName, creationalCallbackVarName, enabled, enclosingType, postInitCallbackVar, preDestroyCallbackVar, provider, qualifyingMetadata, qualifyingTypeInformation, replaceable, singleton, softDisabled, testMock
 
Constructor Summary
QualifiedTypeInjectorDelegate(MetaClass type, Injector delegate, MetaParameterizedType parameterizedType)
           
 
Method Summary
 Statement getBeanInstance(InjectableInstance injectableInstance)
          Return a statement providing access to the injector (or null for asynchronous logic)
 MetaClass getConcreteInjectedType()
          Returns the concrete type that will be returned by this injector.
 String getCreationalCallbackVarName()
          The unique variable name for a BeanProvider associated with this bean.
 Injector getDelegate()
           
 MetaClass getEnclosingType()
          The enclosing type of the injector.
 MetaClass getInjectedType()
          The injected type of the injector.
 String getInstanceVarName()
          The unique variable name for the bean instance.
 String getPostInitCallbackVar()
          The unique variable name for the InitalizationCallback associated with a bean CreationalContext in the boostrapper method.
 String getPreDestroyCallbackVar()
          The unique variable name for the DestructionCallback associated with the BeanProvider for this bean.
 boolean isAlternative()
          Checks if the injector an alternative.
 boolean isDependent()
          Check if the injector if of the dependent scope.
 boolean isEnabled()
          Checks if the injector is enabled, and is eligible for injection consideration.
 boolean isProvider()
          Checks if the injector represents a provider.
 boolean isPseudo()
          Checks if the injector is a psuedo bean.
 boolean isRendered()
          Checks if the injector's BeanProvider already been rendered.
 boolean isSingleton()
          Checks if the injector for a singleton bean.
 boolean isSoftDisabled()
          Checks if the injector is soft disabled.
 boolean isTestMock()
          Checks if the injector represents a test mock.
 void registerWithBeanManager(InjectionContext context, Statement valueRef)
           
 void renderProvider(InjectableInstance injectableInstance)
           
 void setEnabled(boolean enabled)
          Set the enabled state of the bean.
 void setPostInitCallbackVar(String var)
          Sets a variable name reference to the InitializationCallback to associate with the BeanProvider for this bean.
 void setPreDestroyCallbackVar(String preDestroyCallbackVar)
          Sets a variable name reference to the DestructionCallback to associate with this BeanProvider for this bean.
 void setSoftDisabled(boolean softDisabled)
           
 String toString()
           
 
Methods inherited from class org.jboss.errai.ioc.rebind.ioc.injector.AbstractInjector
addDisablingHook, addInvokeAfter, addInvokeAround, addInvokeBefore, addProxyProperty, addProxyProperty, addRegistrationHook, addRenderingHook, addStatementToEndOfInjector, createProxyDeclaration, createProxyDeclaration, disableSoftly, getAddToEndStatements, getAttribute, getBeanName, getDisablingCallbacks, getMetadataWithAny, getProxyInstanceVarName, getProxyPropertyMap, getQualifyingMetadata, getQualifyingTypeInformation, getRegistrationHooks, getRenderingHooks, getWeavingStatements, getWeavingStatementsMap, hasAttribute, hasNewQualifier, isCreated, isProxied, isRegularTypeInjector, isStatic, markRendered, matches, setAttribute, setCreated, setCreationalCallbackVarName, setRendered, setReplaceable, updateProxies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected final MetaClass type

delegate

protected final Injector delegate
Constructor Detail

QualifiedTypeInjectorDelegate

public QualifiedTypeInjectorDelegate(MetaClass type,
                                     Injector delegate,
                                     MetaParameterizedType parameterizedType)
Method Detail

renderProvider

public void renderProvider(InjectableInstance injectableInstance)

isRendered

public boolean isRendered()
Description copied from interface: Injector
Checks if the injector's BeanProvider already been rendered.

Specified by:
isRendered in interface Injector
Overrides:
isRendered in class AbstractInjector
Returns:
true if the creational callback has already been rendered.

isTestMock

public boolean isTestMock()
Description copied from interface: Injector
Checks if the injector represents a test mock.

Specified by:
isTestMock in interface Injector
Overrides:
isTestMock in class AbstractInjector
Returns:
true if the injector is a test mock

isSingleton

public boolean isSingleton()
Description copied from interface: Injector
Checks if the injector for a singleton bean.

Specified by:
isSingleton in interface Injector
Overrides:
isSingleton in class AbstractInjector
Returns:
true if the injector handles a singleton bean.

isPseudo

public boolean isPseudo()
Description copied from interface: Injector
Checks if the injector is a psuedo bean. A psuedo bean is a bean which has been discovered in the classpath and is by default considered part of the dependent scope. But it's scope may be overridden through further processing.

Specified by:
isPseudo in interface Injector
Overrides:
isPseudo in class AbstractInjector
Returns:
true if the injector is for a psuedo bean.

getInstanceVarName

public String getInstanceVarName()
Description copied from interface: Injector
The unique variable name for the bean instance. Usually used to reference the bean during the wiring of the bean within the CreationalContext.getInstance() method body. This variable name is also used to provide a name to variable which holds a reference to singleton instances.

Specified by:
getInstanceVarName in interface Injector
Overrides:
getInstanceVarName in class AbstractInjector
Returns:
the unique variable name for a bean in the bootstrapper and CreationalContext.getInstance() method.

getInjectedType

public MetaClass getInjectedType()
Description copied from interface: Injector
The injected type of the injector. This is the absolute type which the injector produces. For producers, this is the bean type which the producer method returns.

Returns:
the return type from the injector.

getBeanInstance

public Statement getBeanInstance(InjectableInstance injectableInstance)
Description copied from interface: Injector
Return a statement providing access to the injector (or null for asynchronous logic)

Returns:

isDependent

public boolean isDependent()
Description copied from interface: Injector
Check if the injector if of the dependent scope.

Specified by:
isDependent in interface Injector
Overrides:
isDependent in class AbstractInjector
Returns:
true if the injector is of a dependent scope.

isProvider

public boolean isProvider()
Description copied from interface: Injector
Checks if the injector represents a provider.

Specified by:
isProvider in interface Injector
Overrides:
isProvider in class AbstractInjector
Returns:
true if the injector is for a provider.

getEnclosingType

public MetaClass getEnclosingType()
Description copied from interface: Injector
The enclosing type of the injector. For producer injectors, this method will return the bean which the producer method is a member.

Specified by:
getEnclosingType in interface Injector
Overrides:
getEnclosingType in class AbstractInjector
Returns:
the enclosing bean type of the injector, if applicable. Null if not applicable.

getPostInitCallbackVar

public String getPostInitCallbackVar()
Description copied from interface: Injector
The unique variable name for the InitalizationCallback associated with a bean CreationalContext in the boostrapper method.

Specified by:
getPostInitCallbackVar in interface Injector
Overrides:
getPostInitCallbackVar in class AbstractInjector
Returns:
the unique variable name for an InitializationCallback instance. Null if none.

getPreDestroyCallbackVar

public String getPreDestroyCallbackVar()
Description copied from interface: Injector
The unique variable name for the DestructionCallback associated with the BeanProvider for this bean.

Specified by:
getPreDestroyCallbackVar in interface Injector
Overrides:
getPreDestroyCallbackVar in class AbstractInjector
Returns:
the unique variable name for a DestructionCallback instance. Null if none.

setPostInitCallbackVar

public void setPostInitCallbackVar(String var)
Description copied from interface: Injector
Sets a variable name reference to the InitializationCallback to associate with the BeanProvider for this bean.

Specified by:
setPostInitCallbackVar in interface Injector
Overrides:
setPostInitCallbackVar in class AbstractInjector
Parameters:
var - a unique variable name pointing to an instance of InitializationCallback.

setPreDestroyCallbackVar

public void setPreDestroyCallbackVar(String preDestroyCallbackVar)
Description copied from interface: Injector
Sets a variable name reference to the DestructionCallback to associate with this BeanProvider for this bean.

Specified by:
setPreDestroyCallbackVar in interface Injector
Overrides:
setPreDestroyCallbackVar in class AbstractInjector
Parameters:
preDestroyCallbackVar - a unique variable name pointing to an instance of InitializationCallback

getCreationalCallbackVarName

public String getCreationalCallbackVarName()
Description copied from interface: Injector
The unique variable name for a BeanProvider associated with this bean.

Specified by:
getCreationalCallbackVarName in interface Injector
Overrides:
getCreationalCallbackVarName in class AbstractInjector
Returns:
the unique variable name for the BeanProvider.

registerWithBeanManager

public void registerWithBeanManager(InjectionContext context,
                                    Statement valueRef)
Overrides:
registerWithBeanManager in class AbstractInjector

getConcreteInjectedType

public MetaClass getConcreteInjectedType()
Description copied from interface: Injector
Returns the concrete type that will be returned by this injector.

Specified by:
getConcreteInjectedType in interface Injector
Overrides:
getConcreteInjectedType in class AbstractInjector
Returns:

isAlternative

public boolean isAlternative()
Description copied from interface: Injector
Checks if the injector an alternative.

Specified by:
isAlternative in interface Injector
Overrides:
isAlternative in class AbstractInjector
Returns:
true if the injector is an alternative

isSoftDisabled

public boolean isSoftDisabled()
Description copied from interface: Injector
Checks if the injector is soft disabled. This is an optimization flag, allowing for the code optimizers to indicate they'd like to remove the underlying bean. Soft disabled injectors will always report as not being enabled, but are subject to reactivation if they are requested for injection.

Specified by:
isSoftDisabled in interface Injector
Overrides:
isSoftDisabled in class AbstractInjector
Returns:
true if the injector is soft disabled.

setSoftDisabled

public void setSoftDisabled(boolean softDisabled)
Overrides:
setSoftDisabled in class AbstractInjector

isEnabled

public boolean isEnabled()
Description copied from interface: Injector
Checks if the injector is enabled, and is eligible for injection consideration.

Specified by:
isEnabled in interface Injector
Overrides:
isEnabled in class AbstractInjector
Returns:
true if the injector is enabled

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: Injector
Set the enabled state of the bean. A bean that has been disabled (set to false), is not eligible for injection.

Specified by:
setEnabled in interface Injector
Overrides:
setEnabled in class AbstractInjector
Parameters:
enabled - the enabled state of the bean to set (true for enabled, false for disabled).

toString

public String toString()
Overrides:
toString in class AbstractInjector

getDelegate

public Injector getDelegate()

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.