Package org.springframework.aot.generate
Class DefaultMethodReference
java.lang.Object
org.springframework.aot.generate.DefaultMethodReference
- All Implemented Interfaces:
- MethodReference
Default 
MethodReference implementation based on a MethodSpec.- Since:
- 6.0
- Author:
- Stephane Nicoll, Phillip Webb
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.aot.generate.MethodReferenceMethodReference.ArgumentCodeGenerator
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultMethodReference(org.springframework.javapoet.MethodSpec method, org.springframework.javapoet.ClassName declaringClass) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddArguments(org.springframework.javapoet.CodeBlock.Builder code, MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Add the code for the method arguments using the specifiedMethodReference.ArgumentCodeGeneratorif necessary.protected org.springframework.javapoet.CodeBlockinstantiateDeclaringClass(org.springframework.javapoet.ClassName declaringClass) org.springframework.javapoet.CodeBlockReturn this method reference as aCodeBlock.org.springframework.javapoet.CodeBlocktoInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, org.springframework.javapoet.ClassName targetClassName) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.toString()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.aot.generate.MethodReferencetoInvokeCodeBlock
- 
Constructor Details- 
DefaultMethodReferencepublic DefaultMethodReference(org.springframework.javapoet.MethodSpec method, @Nullable org.springframework.javapoet.ClassName declaringClass) 
 
- 
- 
Method Details- 
toCodeBlockpublic org.springframework.javapoet.CodeBlock toCodeBlock()Description copied from interface:MethodReferenceReturn this method reference as aCodeBlock. If the reference is to an instance method thenthis::<method name>will be returned.- Specified by:
- toCodeBlockin interface- MethodReference
- Returns:
- a code block for the method reference.
 
- 
toInvokeCodeBlockpublic org.springframework.javapoet.CodeBlock toInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, @Nullable org.springframework.javapoet.ClassName targetClassName) Description copied from interface:MethodReferenceReturn 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. - Specified by:
- toInvokeCodeBlockin interface- MethodReference
- Parameters:
- argumentCodeGenerator- the argument code generator to use
- targetClassName- the target class name
- Returns:
- a code block to invoke the method
 
- 
addArgumentsprotected void addArguments(org.springframework.javapoet.CodeBlock.Builder code, MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Add the code for the method arguments using the specifiedMethodReference.ArgumentCodeGeneratorif necessary.- Parameters:
- code- the code builder to use to add method arguments
- argumentCodeGenerator- the code generator to use
 
- 
instantiateDeclaringClassprotected org.springframework.javapoet.CodeBlock instantiateDeclaringClass(org.springframework.javapoet.ClassName declaringClass) 
- 
toString
 
-