Class MethodDef

java.lang.Object
io.micronaut.sourcegen.model.MethodDef

public final class MethodDef extends Object
The method definition.
Since:
1.0
Author:
Denis Stepanov
  • Field Details

    • name

      protected final String name
    • modifiers

      protected final Set<Modifier> modifiers
  • Method Details

    • constructor

      public static MethodDef.MethodDefBuilder constructor()
      Returns:
      Starts a constructor.
    • constructor

      public static MethodDef constructor(ClassTypeDef thisType, Collection<ParameterDef> parameterDefs, Modifier... modifiers)
      Create a new constructor with parameters assigned to fields with the same name.
      Parameters:
      thisType - The type to be constructed
      parameterDefs - The parameters of the body
      modifiers - The constructor modifiers
      Returns:
      A new constructor with a body.
    • getReturnType

      public TypeDef getReturnType()
    • getParameters

      public List<ParameterDef> getParameters()
    • getStatements

      public List<StatementDef> getStatements()
    • findParameter

      @Nullable public @Nullable ParameterDef findParameter(String name)
    • getParameter

      @NonNull public @NonNull ParameterDef getParameter(String name)
    • isOverride

      public boolean isOverride()
      Returns:
      True if method is an override
    • isConstructor

      public boolean isConstructor()
      Returns:
      True if method is a constructor
    • builder

      public static MethodDef.MethodDefBuilder builder(String name)
    • getName

      public final String getName()
    • getModifiers

      public final Set<Modifier> getModifiers()
    • getModifiersArray

      public final Modifier[] getModifiersArray()
    • getAnnotations

      public final List<AnnotationDef> getAnnotations()
    • getJavadoc

      public List<String> getJavadoc()