Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.rebind.ioc.injector
Class InjectUtil

java.lang.Object
  extended by org.jboss.errai.ioc.rebind.ioc.injector.InjectUtil

public class InjectUtil
extends Object


Nested Class Summary
static class InjectUtil.AbstractBeanMetric
           
static interface InjectUtil.BeanMetric
           
 
Constructor Summary
InjectUtil()
           
 
Method Summary
static InjectUtil.BeanMetric analyzeBean(InjectionContext context, MetaClass clazz)
           
static boolean checkIfTypeNeedsAddingToBeanStore(InjectionContext context, Injector injector)
           
static Statement createDestructionCallback(MetaClass type, String initVar, List<Statement> statementList)
           
static Statement createInitializationCallback(MetaClass type, String initVar, List<Statement> statementList)
           
static List<Annotation> extractQualifiers(InjectableInstance<? extends Annotation> injectableInstance)
           
static Set<Injector> getBeanInjectionTrackStore(InjectionContext context)
          A utility to get or create the store whereby the code that binds beans to the client bean manager can keep track of what it has already bound.
static ConstructionStrategy getConstructionStrategy(Injector injector, InjectionContext ctx)
           
static InjectUtil.BeanMetric getFilteredBeanMetric(InjectionContext context, MetaClass clazz, Class<? extends Annotation> annotatedWith)
           
static Statement getInjectorOrProxy(InjectionContext ctx, InjectableInstance injectableInstance, MetaClass clazz, QualifyingMetadata qualifyingMetadata)
           
static Statement getInjectorOrProxy(InjectionContext ctx, InjectableInstance injectableInstance, MetaClass clazz, QualifyingMetadata qualifyingMetadata, boolean alwaysProxyDependent)
           
static String getNewInjectorName()
           
static ProxyInjector getOrCreateProxy(InjectionContext ctx, MetaClass clazz, QualifyingMetadata qualifyingMetadata)
           
static Statement getPrivateFieldValue(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext, Statement obj, MetaField field)
          Retrieves the value of a private field managed IOC component.
static Statement getPublicOrPrivateFieldValue(InjectionContext context, Statement obj, MetaField field)
          Read from the specified field, and automatically determine whether to make a public or private read based on the visibility of the specified field.
static List<Annotation> getQualifiersFromAnnotations(Annotation[] annotations)
           
static Annotation[] getQualifiersFromAnnotationsAsArray(Annotation[] annotations)
           
static String getUniqueVarName()
           
static String getVarNameFromType(MetaClass clazz, InjectableInstance instance)
           
static String getVarNameFromType(MetaClass clazz, MetaField parameter)
           
static String getVarNameFromType(MetaClass clazz, MetaParameter parameter)
           
static Statement invokePrivateMethod(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext, Statement obj, MetaMethod method, Statement... arguments)
          Invokes a private method on a managed IOC component.
static Statement invokePublicOrPrivateMethod(InjectionContext context, Statement obj, MetaMethod method, Statement... arguments)
          Invoke the specified method, and automatically determine whether to make the invocation public or private based on the visibility of the specified method.
static Statement[] resolveInjectionDependencies(MetaParameter[] parms, InjectionContext ctx, MetaConstructor constructor)
           
static Statement[] resolveInjectionDependencies(MetaParameter[] parms, InjectionContext ctx, MetaMethod method)
           
static Statement[] resolveInjectionDependencies(MetaParameter[] parms, InjectionContext ctx, MetaMethod method, boolean inlineReference)
           
static List<MetaMethod> scanForAnnotatedMethod(MetaClass type, Class<? extends Annotation> annotationType)
           
static Statement setPrivateFieldValue(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext, Statement obj, MetaField field, Statement val)
          Set the value of a private field on a managed IOC component.
static Statement setPublicOrPrivateFieldValue(InjectionContext context, Statement obj, MetaField field, Statement val)
          Write to the specified field, and automatically determine whether to make a public or private write based on the visibility of the specified field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InjectUtil

public InjectUtil()
Method Detail

getConstructionStrategy

public static ConstructionStrategy getConstructionStrategy(Injector injector,
                                                           InjectionContext ctx)

scanForAnnotatedMethod

public static List<MetaMethod> scanForAnnotatedMethod(MetaClass type,
                                                      Class<? extends Annotation> annotationType)

getInjectorOrProxy

public static Statement getInjectorOrProxy(InjectionContext ctx,
                                           InjectableInstance injectableInstance,
                                           MetaClass clazz,
                                           QualifyingMetadata qualifyingMetadata)

getInjectorOrProxy

public static Statement getInjectorOrProxy(InjectionContext ctx,
                                           InjectableInstance injectableInstance,
                                           MetaClass clazz,
                                           QualifyingMetadata qualifyingMetadata,
                                           boolean alwaysProxyDependent)

getOrCreateProxy

public static ProxyInjector getOrCreateProxy(InjectionContext ctx,
                                             MetaClass clazz,
                                             QualifyingMetadata qualifyingMetadata)

resolveInjectionDependencies

public static Statement[] resolveInjectionDependencies(MetaParameter[] parms,
                                                       InjectionContext ctx,
                                                       MetaMethod method)

resolveInjectionDependencies

public static Statement[] resolveInjectionDependencies(MetaParameter[] parms,
                                                       InjectionContext ctx,
                                                       MetaMethod method,
                                                       boolean inlineReference)

resolveInjectionDependencies

public static Statement[] resolveInjectionDependencies(MetaParameter[] parms,
                                                       InjectionContext ctx,
                                                       MetaConstructor constructor)

getNewInjectorName

public static String getNewInjectorName()

getUniqueVarName

public static String getUniqueVarName()

getVarNameFromType

public static String getVarNameFromType(MetaClass clazz,
                                        MetaParameter parameter)

getVarNameFromType

public static String getVarNameFromType(MetaClass clazz,
                                        MetaField parameter)

getVarNameFromType

public static String getVarNameFromType(MetaClass clazz,
                                        InjectableInstance instance)

extractQualifiers

public static List<Annotation> extractQualifiers(InjectableInstance<? extends Annotation> injectableInstance)

getQualifiersFromAnnotations

public static List<Annotation> getQualifiersFromAnnotations(Annotation[] annotations)

getQualifiersFromAnnotationsAsArray

public static Annotation[] getQualifiersFromAnnotationsAsArray(Annotation[] annotations)

analyzeBean

public static InjectUtil.BeanMetric analyzeBean(InjectionContext context,
                                                MetaClass clazz)

getFilteredBeanMetric

public static InjectUtil.BeanMetric getFilteredBeanMetric(InjectionContext context,
                                                          MetaClass clazz,
                                                          Class<? extends Annotation> annotatedWith)

createInitializationCallback

public static Statement createInitializationCallback(MetaClass type,
                                                     String initVar,
                                                     List<Statement> statementList)

createDestructionCallback

public static Statement createDestructionCallback(MetaClass type,
                                                  String initVar,
                                                  List<Statement> statementList)

getBeanInjectionTrackStore

public static Set<Injector> getBeanInjectionTrackStore(InjectionContext context)
A utility to get or create the store whereby the code that binds beans to the client bean manager can keep track of what it has already bound.

Returns:
-

checkIfTypeNeedsAddingToBeanStore

public static boolean checkIfTypeNeedsAddingToBeanStore(InjectionContext context,
                                                        Injector injector)

getPrivateFieldValue

public static Statement getPrivateFieldValue(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext,
                                             Statement obj,
                                             MetaField field)
Retrieves the value of a private field managed IOC component.

Parameters:
processingContext - an instance of the IOCProcessingContext
obj - a Statement reference to the bean instance whose field is to be accessed. null can be provided for static field access.
field - the MetaField which will be privately accessed
Returns:
a Statement reference to the value of the field.

setPrivateFieldValue

public static Statement setPrivateFieldValue(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext,
                                             Statement obj,
                                             MetaField field,
                                             Statement val)
Set the value of a private field on a managed IOC component.

Parameters:
processingContext - an instance of the IOCProcessingContext
obj - a Statement reference to the bean instance whose field is to be accessed. null can be provided for static field access.
field - the MetaField which will be privately accessed
val - the Statement reference to the value to be set.
Returns:
the Statement which will perform the writing to the field.

invokePrivateMethod

public static Statement invokePrivateMethod(org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCProcessingContext processingContext,
                                            Statement obj,
                                            MetaMethod method,
                                            Statement... arguments)
Invokes a private method on a managed IOC component.

Parameters:
processingContext - an instance of the IOCProcessingContext
obj - a Statement reference to the bean instance whose field is to be accessed. null can be provided for static method calls.
method - the MetaMethod to be invoked
arguments - the arguments to be passed to the private method
Returns:
the Statement which represents the return value of the method.

getPublicOrPrivateFieldValue

public static Statement getPublicOrPrivateFieldValue(InjectionContext context,
                                                     Statement obj,
                                                     MetaField field)
Read from the specified field, and automatically determine whether to make a public or private read based on the visibility of the specified field.

Parameters:
context - an instance of the InjectionContext
obj - a Statement reference to the bean instance whose field is to be accessed
field - the MetaField which will be privately accessed
Returns:
a Statement reference to the value of the field.

setPublicOrPrivateFieldValue

public static Statement setPublicOrPrivateFieldValue(InjectionContext context,
                                                     Statement obj,
                                                     MetaField field,
                                                     Statement val)
Write to the specified field, and automatically determine whether to make a public or private write based on the visibility of the specified field.

Parameters:
context - an instance of the InjectionContext
obj - a Statement reference to the bean instance whose field is to be accessed
field - the MetaField which will be privately accessed
val - the Statement reference to the value to be set.
Returns:
the Statement which will perform the writing to the field.

invokePublicOrPrivateMethod

public static Statement invokePublicOrPrivateMethod(InjectionContext context,
                                                    Statement obj,
                                                    MetaMethod method,
                                                    Statement... arguments)
Invoke the specified method, and automatically determine whether to make the invocation public or private based on the visibility of the specified method.

Parameters:
context - an instance of the InjectionContext
obj - a Statement reference to the bean instance whose field is to be accessed
method - the MetaMethod to be invoked
arguments - the arguments to be passed to the private method
Returns:
the Statement which represents the return value of the method.

Errai 3.0.1-SNAPSHOT

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