Package org.drools.codegen.common.di
Interface DependencyInjectionAnnotator
- All Known Implementing Classes:
CDIDependencyInjectionAnnotator,SpringDependencyInjectionAnnotator
public interface DependencyInjectionAnnotator
Generic abstraction for dependency injection annotations that allow to
use different frameworks based needs.
Currently in scope
- CDI
- Spring
-
Method Summary
Modifier and TypeMethodDescriptionReturns type that allows to mark instance as application component e.g.emitterType(String dataType) Returns type to be used as message emittercom.github.javaparser.ast.expr.ExpressiongetMultiInstance(String fieldName) Creates an expression that returns a list of instances for given multi instance fielddefault com.github.javaparser.ast.expr.ExpressiongetOptionalInstance(String fieldName) Creates an expression that returns instance for given optional fieldReturns type that allows to inject multiple instances of the same typecom.github.javaparser.ast.expr.ExpressionoptionalInstanceExists(String fieldName) Creates an expression that represents optional instance for given fieldReturns type that allows to inject optional instances of the same type<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithApplicationComponent(T node) Annotates given node with application level annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithConfigInjection(T node, String configKey) Annotates given node with configuration parameter injection<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithConfigInjection(T node, String configKey, String defaultValue) Annotates given node with configuration parameter injection with default value<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithEagerStartup(T node) Annotates given node with a initializing annotation e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithFactoryClass(T node) Annotates given node with factory class annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithFactoryMethod(T node) Annotates given node with factory method annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithIncomingMessage(T node, String channel) Annotates given node with incoming message that it should consume fromdefault <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithInjection(T node) Annotates given node with injection annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithInjection(T node, boolean forceLazyInit) Annotates given node with injection annotations e.g.com.github.javaparser.ast.expr.MethodCallExprwithMessageProducer(com.github.javaparser.ast.expr.MethodCallExpr produceMethod, String channel, com.github.javaparser.ast.expr.Expression event) Annotates and enhances method used to produce messages<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TAnnotates given node with name annotation e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithNamedApplicationComponent(T node, String name) Annotates given node with application level annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithNamedInjection(T node, String name) Annotates given node with injection annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithNamedSingletonComponent(T node, String name) Annotates given node with singleton level annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithOptionalInjection(T node) Annotates given node with optional injection annotations e.g.<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithOutgoingMessage(T node, String channel) Annotates given node with outgoing message that it should send to<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithProduces(T node, boolean isDefault) Annotates the given node with an annotation to produce a DI instance of the node target class, e.g.default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithSecurityRoles(T node, String[] roles) Annotates given node with set of roles to enforce security<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithSingletonComponent(T node) Annotates given node with singleton level annotations e.g.default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithTagAnnotation(T node, com.github.javaparser.ast.NodeList<com.github.javaparser.ast.expr.MemberValuePair> attributes) default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>>
TwithTransactional(T node) Annotates given node with Transactional annotation
-
Method Details
-
withProduces
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withProduces(T node, boolean isDefault) Annotates the given node with an annotation to produce a DI instance of the node target class, e.g. Produces, Bean. This is used by configuration classes in the DI, like a factory method.- Parameters:
node-isDefault- indicates if the bean instance is created only if there are not any other bean of this type already declared in the application, e.g DefaultBean
-
withNamed
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withNamed(T node, String name) Annotates given node with name annotation e.g. Named, Qualifier- Parameters:
node- node to be annotated
-
withApplicationComponent
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withApplicationComponent(T node) Annotates given node with application level annotations e.g. ApplicationScoped, Component- Parameters:
node- node to be annotated
-
withNamedApplicationComponent
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withNamedApplicationComponent(T node, String name) Annotates given node with application level annotations e.g. ApplicationScoped, Component additionally adding name to it- Parameters:
node- node to be annotatedname- name to be assigned to given node
-
withSingletonComponent
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withSingletonComponent(T node) Annotates given node with singleton level annotations e.g. Singleton, Component- Parameters:
node- node to be annotated
-
withNamedSingletonComponent
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withNamedSingletonComponent(T node, String name) Annotates given node with singleton level annotations e.g. Singleton, Component additionally adding name to it- Parameters:
node- node to be annotatedname- name to be assigned to given node
-
withInjection
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withInjection(T node, boolean forceLazyInit) Annotates given node with injection annotations e.g. Inject, Autowire- Parameters:
node- node to be annotated
-
withInjection
default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withInjection(T node) Annotates given node with injection annotations e.g. Inject, Autowire- Parameters:
node- node to be annotated
-
withNamedInjection
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withNamedInjection(T node, String name) Annotates given node with injection annotations e.g. Inject, Autowire additionally adding name to it- Parameters:
node- node to be annotatedname- name to be assigned to given node
-
withOptionalInjection
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withOptionalInjection(T node) Annotates given node with optional injection annotations e.g. Inject, Autowire- Parameters:
node- node to be annotated
-
withIncomingMessage
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withIncomingMessage(T node, String channel) Annotates given node with incoming message that it should consume from- Parameters:
node- node to be annotatedchannel- name of the channel messages should be consumer from
-
withOutgoingMessage
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withOutgoingMessage(T node, String channel) Annotates given node with outgoing message that it should send to- Parameters:
node- node to be annotatedchannel- name of the channel messages should be send to
-
withConfigInjection
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withConfigInjection(T node, String configKey) Annotates given node with configuration parameter injection- Parameters:
node- node to be annotatedconfigKey- name of the configuration property to be injected
-
withConfigInjection
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withConfigInjection(T node, String configKey, String defaultValue) Annotates given node with configuration parameter injection with default value- Parameters:
node- node to be annotatedconfigKey- name of the configuration property to be injecteddefaultValue- value to be used in case there is no config parameter defined
-
withTransactional
default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withTransactional(T node) Annotates given node with Transactional annotation- Parameters:
node- node to be annotated
-
getTransactionalAnnotation
String getTransactionalAnnotation() -
withMessageProducer
com.github.javaparser.ast.expr.MethodCallExpr withMessageProducer(com.github.javaparser.ast.expr.MethodCallExpr produceMethod, String channel, com.github.javaparser.ast.expr.Expression event) Annotates and enhances method used to produce messages- Parameters:
produceMethod- method to be annotatedchannel- channel on which messages should be producedevent- actual data to be send
-
withSecurityRoles
default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withSecurityRoles(T node, String[] roles) Annotates given node with set of roles to enforce security- Parameters:
node- node to be annotatedroles- roles that are allowed
-
optionalInstanceInjectionType
String optionalInstanceInjectionType()Returns type that allows to inject optional instances of the same type- Returns:
- fully qualified class name
-
optionalInstanceExists
Creates an expression that represents optional instance for given field- Parameters:
fieldName- name of the field that should be considered optional- Returns:
- complete expression for optional instance
-
getOptionalInstance
Creates an expression that returns instance for given optional field- Parameters:
fieldName- name of the optional field that should be accessed- Returns:
- complete expression for optional instance
-
multiInstanceInjectionType
String multiInstanceInjectionType()Returns type that allows to inject multiple instances of the same type- Returns:
- fully qualified class name
-
getMultiInstance
Creates an expression that returns a list of instances for given multi instance field- Parameters:
fieldName- name of the multi field that should be accessed- Returns:
- complete expression for multi instance
-
applicationComponentType
String applicationComponentType()Returns type that allows to mark instance as application component e.g. ApplicationScoped, Component- Returns:
- fully qualified class name
-
emitterType
Returns type to be used as message emitter- Parameters:
dataType- type of the data produces by the emitter- Returns:
- fully qualified class name
-
withEagerStartup
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withEagerStartup(T node) Annotates given node with a initializing annotation e.g. Startup- Parameters:
node- node to be annotated
-
withFactoryClass
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withFactoryClass(T node) Annotates given node with factory class annotations e.g. Configuration for Spring Boot- Parameters:
node- node to be annotated
-
withFactoryMethod
<T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withFactoryMethod(T node) Annotates given node with factory method annotations e.g. Produces, Bean- Parameters:
node- node to be annotated
-
withTagAnnotation
default <T extends com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>> T withTagAnnotation(T node, com.github.javaparser.ast.NodeList<com.github.javaparser.ast.expr.MemberValuePair> attributes)
-