Interface JMethodDef

All Superinterfaces:
JAnnotatable, JCommentable, JDocCommentable, JGenericDef

public interface JMethodDef extends JGenericDef, JAnnotatable, JDocCommentable
A method or constructor definition.
Author:
David M. Lloyd
  • Method Details

    • _default

      JBlock _default()
      A default method body for a JDK 8+ interface method.
      Returns:
      the method body
    • _default

      JMethodDef _default(JExpr expr)
      A default value for an annotation method.
      Parameters:
      expr - the value
      Returns:
      this method definition
    • body

      JBlock body()
      Get the method body.
      Returns:
      the method body
    • returnsDoc

      JComment returnsDoc()
      Get the @return doc comment block.
      Returns:
      the comment block
    • param

      JParamDeclaration param(int mods, JType type, String name)
      Add a parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      JParamDeclaration param(JType type, String name)
      Add a parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      JParamDeclaration param(int mods, String type, String name)
      Add a parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      JParamDeclaration param(String type, String name)
      Add a parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      JParamDeclaration param(int mods, Class<?> type, String name)
      Add a parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      JParamDeclaration param(Class<?> type, String name)
      Add a parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(int mods, JType type, String name)
      Add a vararg parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(JType type, String name)
      Add a vararg parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(int mods, String type, String name)
      Add a vararg parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(String type, String name)
      Add a vararg parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(int mods, Class<?> type, String name)
      Add a vararg parameter to this method.
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      JParamDeclaration varargParam(Class<?> type, String name)
      Add a vararg parameter to this method.
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • params

      JParamDeclaration[] params()
      Get the list of parameters defined thus far.
      Returns:
      the parameter list
    • _throws

      JComment _throws(String type)
      Get a @throws doc comment block.
      Parameters:
      type - the exception type
      Returns:
      the doc comment block
    • _throws

      JComment _throws(JType type)
      Get a @throws doc comment block.
      Parameters:
      type - the exception type
      Returns:
      the doc comment block
    • _throws

      JComment _throws(Class<? extends Throwable> type)
      Get a @throws doc comment block.
      Parameters:
      type - the exception type
      Returns:
      the doc comment block