接口 MethodReference
- 所有已知实现类:
DefaultMethodReference
public interface MethodReference
A reference to a method with convenient code generation for
referencing, or invoking it.
- 从以下版本开始:
- 4.0
- 作者:
- Stephane Nicoll, Phillip Webb
-
嵌套类概要
嵌套类修饰符和类型接口说明static interfaceStrategy for generating code for arguments based on their type. -
方法概要
修饰符和类型方法说明cn.taketoday.javapoet.CodeBlockReturn this method reference as aCodeBlock.default cn.taketoday.javapoet.CodeBlocktoInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.cn.taketoday.javapoet.CodeBlocktoInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, cn.taketoday.javapoet.ClassName targetClassName) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.
-
方法详细资料
-
toCodeBlock
cn.taketoday.javapoet.CodeBlock toCodeBlock()Return this method reference as aCodeBlock. If the reference is to an instance method thenthis::<method name>will be returned.- 返回:
- a code block for the method reference.
-
toInvokeCodeBlock
default cn.taketoday.javapoet.CodeBlock toInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator) Return this method reference as aCodeBlockusing the specifiedMethodReference.ArgumentCodeGenerator.- 参数:
argumentCodeGenerator- the argument code generator to use- 返回:
- a code block to invoke the method
-
toInvokeCodeBlock
cn.taketoday.javapoet.CodeBlock toInvokeCodeBlock(MethodReference.ArgumentCodeGenerator argumentCodeGenerator, @Nullable cn.taketoday.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.
- 参数:
argumentCodeGenerator- the argument code generator to usetargetClassName- the target class name- 返回:
- a code block to invoke the method
-