接口 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
  • 方法详细资料

    • toCodeBlock

      cn.taketoday.javapoet.CodeBlock toCodeBlock()
      Return this method reference as a CodeBlock. If the reference is to an instance method then this::<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 a CodeBlock using the specified MethodReference.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 a CodeBlock using the specified MethodReference.ArgumentCodeGenerator. The targetClassName defines 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 use
      targetClassName - the target class name
      返回:
      a code block to invoke the method