Package org.springframework.aot.generate
Interface MethodReference
- All Known Implementing Classes:
- DefaultMethodReference
public interface MethodReference
A reference to a method with convenient code generation for
 referencing, or invoking it.
- Since:
- 6.0
- Author:
- Stephane Nicoll, Phillip Webb
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceStrategy for generating code for arguments based on their type.
- 
Method SummaryModifier and TypeMethodDescriptionorg.springframework.javapoet.CodeBlockReturn this method reference as aCodeBlock.default org.springframework.javapoet.CodeBlocktoInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.org.springframework.javapoet.CodeBlocktoInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, @Nullable org.springframework.javapoet.ClassName targetClassName) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.
- 
Method Details- 
toCodeBlockorg.springframework.javapoet.CodeBlock toCodeBlock()Return this method reference as aCodeBlock. If the reference is to an instance method thenthis::<method name>will be returned.- Returns:
- a code block for the method reference.
 
- 
toInvokeCodeBlockdefault org.springframework.javapoet.CodeBlock toInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.- Parameters:
- argumentCodeGenerator- the argument code generator to use
- Returns:
- a code block to invoke the method
 
- 
toInvokeCodeBlockorg.springframework.javapoet.CodeBlock toInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, @Nullable org.springframework.javapoet.ClassName targetClassName) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator. ThetargetClassNamedefines the context in which the method invocation is added.If the caller has an instance of the type in which this method is defined, it can hint that by specifying the type as a target class. - Parameters:
- argumentCodeGenerator- the argument code generator to use
- targetClassName- the target class name
- Returns:
- a code block to invoke the method
 
 
-