Class ConstructorDef


public class ConstructorDef extends MethodDef
A special version of MethodDef for defining constructors
  • Constructor Details

    • ConstructorDef

      public ConstructorDef(int access, Field[] parameters, Expression body)
      Create a constructor definition
      Parameters:
      access - The access flags for the constructor
      parameters - The name and type for each parameter
      body - The code to execute for this constructor
    • ConstructorDef

      public ConstructorDef(int access, Field[] parameters, Expression body, String filename, int lineNumber)
      Create a constructor definition
      Parameters:
      access - The access flags for the constructor
      parameters - The name and type for each parameter
      body - The code to execute for this constructor
      filename - The name of the file where this constructor is defined
      lineNumber - The line number in the source file where this constructor is defined
  • Method Details

    • generateWith

      public static ConstructorDef generateWith(Field[] parameters)
      Generate a default constructor that just passes its arguments to the superclass constructor
      Parameters:
      parameters - The name and type for each parameter
      Returns:
      A default constructor that only calls the superclass constructor
    • generateWith

      public static ConstructorDef generateWith(Field[] parameters, String filename, int lineNumber)
      Generate a default constructor that just passes its arguments to the superclass constructor
      Parameters:
      parameters - The name and type for each parameter
      filename - The name of the file where this constructor is defined
      lineNumber - The line number in the source file where this constructor is defined
      Returns:
      A default constructor that only calls the superclass constructor