接口 MethodReference.ArgumentCodeGenerator
- 封闭接口:
- MethodReference
public static interface MethodReference.ArgumentCodeGenerator
Strategy for generating code for arguments based on their type.
-
方法概要
修饰符和类型方法说明and(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with the given generator.Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with supporting the given argument type.Factory method that creates a newMethodReference.ArgumentCodeGeneratorfrom a lambda friendly function.cn.taketoday.javapoet.CodeBlockgenerateCode(cn.taketoday.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.
-
方法详细资料
-
generateCode
Generate the code for the given argument type. If this type is not supported, returnnull.- 参数:
argumentType- the argument type- 返回:
- the code for this argument, or
null
-
none
Factory method that returns anMethodReference.ArgumentCodeGeneratorthat always returnsnull.- 返回:
- a new
MethodReference.ArgumentCodeGeneratorinstance
-
of
Factory method that can be used to create anMethodReference.ArgumentCodeGeneratorthat support only the given argument type.- 参数:
argumentType- the argument typeargumentCode- the code for an argument of that type- 返回:
- a new
MethodReference.ArgumentCodeGeneratorinstance
-
from
static MethodReference.ArgumentCodeGenerator from(Function<cn.taketoday.javapoet.TypeName, cn.taketoday.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.- 参数:
function- the resolver function- 返回:
- a new
MethodReference.ArgumentCodeGeneratorinstance backed by the function
-
and
Create a new composedMethodReference.ArgumentCodeGeneratorby combining this generator with supporting the given argument type.- 参数:
argumentType- the argument typeargumentCode- the code for an argument of that type- 返回:
- 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.- 参数:
argumentCodeGenerator- the argument generator to add- 返回:
- a new composite
MethodReference.ArgumentCodeGeneratorinstance
-