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 SummaryModifier 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
 
- 
noneFactory method that returns anMethodReference.ArgumentCodeGeneratorthat always returnsnull.- Returns:
- a new MethodReference.ArgumentCodeGeneratorinstance
 
- 
ofFactory method that can be used to create anMethodReference.ArgumentCodeGeneratorthat support only the given argument type.- Parameters:
- argumentType- the argument type
- argumentCode- the code for an argument of that type
- Returns:
- a new MethodReference.ArgumentCodeGeneratorinstance
 
- 
fromstatic 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
 
- 
andCreate a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with supporting the given argument type.- Parameters:
- argumentType- the argument type
- argumentCode- the code for an argument of that type
- Returns:
- a new composite MethodReference.ArgumentCodeGeneratorinstance
 
- 
anddefault 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
 
 
-