Class AbstractJMethodDef

All Implemented Interfaces:
ClassContent, JAnnotatable, JCommentable, JDocCommentable, JGenericDef, JMethodDef, Writable
Direct Known Subclasses:
ConstructorJMethodDef, MethodJMethodDef

abstract class AbstractJMethodDef extends AbstractJGeneric implements JMethodDef, ClassContent
  • Field Details

  • Constructor Details

  • Method Details

    • _default

      public JBlock _default()
      Description copied from interface: JMethodDef
      A default method body for a JDK 8+ interface method.
      Specified by:
      _default in interface JMethodDef
      Returns:
      the method body
    • _default

      public JMethodDef _default(JExpr expr)
      Description copied from interface: JMethodDef
      A default value for an annotation method.
      Specified by:
      _default in interface JMethodDef
      Parameters:
      expr - the value
      Returns:
      this method definition
    • body

      public JBlock body()
      Description copied from interface: JMethodDef
      Get the method body.
      Specified by:
      body in interface JMethodDef
      Returns:
      the method body
    • returnsDoc

      public JComment returnsDoc()
      Description copied from interface: JMethodDef
      Get the @return doc comment block.
      Specified by:
      returnsDoc in interface JMethodDef
      Returns:
      the comment block
    • add

    • param

      public JParamDeclaration param(int mods, JType type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      public JParamDeclaration param(JType type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      public JParamDeclaration param(int mods, String type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      public JParamDeclaration param(String type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      public JParamDeclaration param(int mods, Class<?> type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • param

      public JParamDeclaration param(Class<?> type, String name)
      Description copied from interface: JMethodDef
      Add a parameter to this method.
      Specified by:
      param in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(int mods, JType type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(JType type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(int mods, String type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(String type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(int mods, Class<?> type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      mods - the parameter modifiers
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • varargParam

      public JParamDeclaration varargParam(Class<?> type, String name)
      Description copied from interface: JMethodDef
      Add a vararg parameter to this method.
      Specified by:
      varargParam in interface JMethodDef
      Parameters:
      type - the parameter type
      name - the parameter name
      Returns:
      the parameter declaration
    • params

      public JParamDeclaration[] params()
      Description copied from interface: JMethodDef
      Get the list of parameters defined thus far.
      Specified by:
      params in interface JMethodDef
      Returns:
      the parameter list
    • _throws

      public JComment _throws(String type)
      Description copied from interface: JMethodDef
      Get a @throws doc comment block.
      Specified by:
      _throws in interface JMethodDef
      Parameters:
      type - the exception type
      Returns:
      the doc comment block
    • _throws

      public JComment _throws(JType type)
      Description copied from interface: JMethodDef
      Get a @throws doc comment block.
      Specified by:
      _throws in interface JMethodDef
      Parameters:
      type - the exception type
      Returns:
      the doc comment block
    • _throws

      public JComment _throws(Class<? extends Throwable> type)
      Description copied from interface: JMethodDef
      Get a @throws doc comment block.
      Specified by:
      _throws in interface JMethodDef
      Parameters:
      type - the exception type
      Returns:
      the doc comment block
    • getModifiers

      int getModifiers()
    • writeBody

      boolean writeBody()
    • write

      public void write(SourceFileWriter writer) throws IOException
      Specified by:
      write in interface Writable
      Throws:
      IOException
    • writePostfix

      void writePostfix(SourceFileWriter writer) throws IOException
      Throws:
      IOException
    • clazz