Package io.micronaut.inject.writer
Class DispatchWriter
java.lang.Object
io.micronaut.inject.writer.DispatchWriter
- All Implemented Interfaces:
ClassOutputWriter
Switch based dispatch writer.
- Since:
- 4.7
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Dispatch target implementation writer.static interface
Dispatch target implementation writer.static final class
Field get dispatch target.static final class
Field set dispatch target.static final class
Interceptable method invocation dispatch target.static final class
Method invocation dispatch target.static final class
Method invocation dispatch target.static final class
Method invocation dispatch target. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ClassWriterOutputVisitor classWriterOutputVisitor) Accept a ClassWriterOutputVisitor to write this writer to disk.int
addDispatchTarget
(DispatchWriter.DispatchTarget dispatchTarget) Adds new custom dispatch target.int
addGetField
(FieldElement beanField) Adds new get field dispatch target.int
addInterceptedMethod
(TypedElement declaringType, MethodElement methodElement, String interceptedProxyClassName, String interceptedProxyBridgeMethodName) Adds new interceptable method dispatch target.int
addMethod
(TypedElement declaringType, MethodElement methodElement) Adds new method dispatch target.int
addMethod
(TypedElement declaringType, MethodElement methodElement, boolean useOneDispatch) Adds new method dispatch target.int
addSetField
(FieldElement beanField) Adds new set field dispatch target.@Nullable io.micronaut.sourcegen.model.MethodDef
@Nullable io.micronaut.sourcegen.model.MethodDef
@Nullable io.micronaut.sourcegen.model.MethodDef
static io.micronaut.sourcegen.model.ExpressionDef
getTypeUtilsGetRequiredMethod
(io.micronaut.sourcegen.model.ClassTypeDef declaringType, MethodElement methodElement) boolean
-
Constructor Details
-
DispatchWriter
public DispatchWriter()
-
-
Method Details
-
addSetField
Adds new set field dispatch target.- Parameters:
beanField
- The field- Returns:
- the target index
-
addGetField
Adds new get field dispatch target.- Parameters:
beanField
- The field- Returns:
- the target index
-
addMethod
Adds new method dispatch target.- Parameters:
declaringType
- The declaring typemethodElement
- The method element- Returns:
- the target index
-
addMethod
public int addMethod(TypedElement declaringType, MethodElement methodElement, boolean useOneDispatch) Adds new method dispatch target.- Parameters:
declaringType
- The declaring typemethodElement
- The method elementuseOneDispatch
- If method should be dispatched using "dispatchOne"- Returns:
- the target index
-
addInterceptedMethod
public int addInterceptedMethod(TypedElement declaringType, MethodElement methodElement, String interceptedProxyClassName, String interceptedProxyBridgeMethodName) Adds new interceptable method dispatch target.- Parameters:
declaringType
- The declaring typemethodElement
- The method elementinterceptedProxyClassName
- The interceptedProxyClassNameinterceptedProxyBridgeMethodName
- The interceptedProxyBridgeMethodName- Returns:
- the target index
-
addDispatchTarget
Adds new custom dispatch target.- Parameters:
dispatchTarget
- The dispatch target implementation- Returns:
- the target index
-
buildDispatchMethod
-
buildDispatchOneMethod
-
buildGetTargetMethodByIndex
-
getTypeUtilsGetRequiredMethod
public static io.micronaut.sourcegen.model.ExpressionDef getTypeUtilsGetRequiredMethod(io.micronaut.sourcegen.model.ClassTypeDef declaringType, MethodElement methodElement) -
accept
Description copied from interface:ClassOutputWriter
Accept a ClassWriterOutputVisitor to write this writer to disk.- Specified by:
accept
in interfaceClassOutputWriter
- Parameters:
classWriterOutputVisitor
- TheClassWriterOutputVisitor
- Throws:
IOException
- if there is an error writing to disk
-
getDispatchTargets
- Returns:
- all added dispatch targets
-
isHasInterceptedMethod
public boolean isHasInterceptedMethod()- Returns:
- if intercepted method dispatch have been added
-