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
Nested ClassesModifier and TypeClassDescriptionstatic classDispatch target implementation writer.static interfaceDispatch target implementation writer.static final classField get dispatch target.static final classField get dispatch target.static final classField set dispatch target.static final classField set dispatch target.static final classInterceptable method invocation dispatch target.static final classMethod invocation dispatch target.static final classMethod invocation dispatch target.static final classMethod invocation dispatch target. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ClassWriterOutputVisitor classWriterOutputVisitor) Accept a ClassWriterOutputVisitor to write this writer to disk.intaddDispatchTarget(DispatchWriter.DispatchTarget dispatchTarget) Adds new custom dispatch target.intaddGetField(FieldElement beanField) Adds new get field dispatch target.intaddInterceptedMethod(TypedElement declaringType, MethodElement methodElement, io.micronaut.sourcegen.model.ClassTypeDef interceptedProxyType, io.micronaut.sourcegen.model.MethodDef interceptedProxyBridgeMethod) Adds new interceptable method dispatch target.intaddMethod(TypedElement declaringType, MethodElement methodElement) Adds new method dispatch target.intaddMethod(TypedElement declaringType, MethodElement methodElement, boolean useOneDispatch) Adds new method dispatch target.intaddSetField(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.MethodDefstatic io.micronaut.sourcegen.model.ExpressionDefgetTypeUtilsGetRequiredMethod(io.micronaut.sourcegen.model.ClassTypeDef declaringType, MethodElement methodElement) boolean
-
Constructor Details
-
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, io.micronaut.sourcegen.model.ClassTypeDef interceptedProxyType, io.micronaut.sourcegen.model.MethodDef interceptedProxyBridgeMethod) Adds new interceptable method dispatch target.- Parameters:
declaringType- The declaring typemethodElement- The method elementinterceptedProxyType- The interceptedProxyTypeinterceptedProxyBridgeMethod- The interceptedProxyBridgeMethod- 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:ClassOutputWriterAccept a ClassWriterOutputVisitor to write this writer to disk.- Specified by:
acceptin 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
-