Package org.springframework.aot.generate
Interface MethodReference.ArgumentCodeGenerator
- Enclosing interface:
 - MethodReference
 
public static interface MethodReference.ArgumentCodeGenerator
Strategy for generating code for arguments based on their type.
- 
Method Summary
Modifier and TypeMethodDescriptionCreate a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with supporting the given argument type.and(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with the given generator.from(Function<org.springframework.javapoet.TypeName, org.springframework.javapoet.CodeBlock> function) Factory method that creates a newMethodReference.ArgumentCodeGeneratorfrom a lambda friendly function.org.springframework.javapoet.CodeBlockgenerateCode(org.springframework.javapoet.TypeName argumentType) Generate the code for the given argument type.none()Factory method that returns anMethodReference.ArgumentCodeGeneratorthat always returnsnull.Factory method that can be used to create anMethodReference.ArgumentCodeGeneratorthat support only the given argument type. 
- 
Method Details
- 
generateCode
@Nullable org.springframework.javapoet.CodeBlock generateCode(org.springframework.javapoet.TypeName argumentType) Generate the code for the given argument type. If this type is not supported, returnnull.- Parameters:
 argumentType- the argument type- Returns:
 - the code for this argument, or 
null 
 - 
none
Factory method that returns anMethodReference.ArgumentCodeGeneratorthat always returnsnull.- Returns:
 - a new 
MethodReference.ArgumentCodeGeneratorinstance 
 - 
of
Factory method that can be used to create anMethodReference.ArgumentCodeGeneratorthat support only the given argument type.- Parameters:
 argumentType- the argument typeargumentCode- the code for an argument of that type- Returns:
 - a new 
MethodReference.ArgumentCodeGeneratorinstance 
 - 
from
static MethodReference.ArgumentCodeGenerator from(Function<org.springframework.javapoet.TypeName, org.springframework.javapoet.CodeBlock> function) Factory method that creates a newMethodReference.ArgumentCodeGeneratorfrom a lambda friendly function. The given function is provided with the argument type and must provide the code to use ornullif the type is not supported.- Parameters:
 function- the resolver function- Returns:
 - a new 
MethodReference.ArgumentCodeGeneratorinstance backed by the function 
 - 
and
Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with supporting the given argument type.- Parameters:
 argumentType- the argument typeargumentCode- the code for an argument of that type- Returns:
 - a new composite 
MethodReference.ArgumentCodeGeneratorinstance 
 - 
and
default MethodReference.ArgumentCodeGenerator and(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with the given generator.- Parameters:
 argumentCodeGenerator- the argument generator to add- Returns:
 - a new composite 
MethodReference.ArgumentCodeGeneratorinstance 
 
 -