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

  • Method Details

    • constructor

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

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

      @NonNull public static @NonNull MethodDef of(@NonNull @NonNull io.micronaut.inject.ast.MethodElement methodElement)
      Creates a method definition from MethodElement.
      Parameters:
      methodElement - The method element
      Returns:
      The method definition
      Since:
      1.5
    • of

      @NonNull public static @NonNull MethodDef of(@NonNull @NonNull Method method)
      Creates a method definition from Method.
      Parameters:
      method - The method
      Returns:
      The method definition
      Since:
      1.5
    • override

      @NonNull public static @NonNull MethodDef.MethodDefBuilder override(@NonNull @NonNull io.micronaut.inject.ast.MethodElement methodElement)
      Creates a method definition builder from MethodElement.
      Parameters:
      methodElement - The methodElement
      Returns:
      The method definition builder
      Since:
      1.5
    • override

      @NonNull public static @NonNull MethodDef.MethodDefBuilder override(@NonNull @NonNull Method method)
      Creates a method definition builder from Method.
      Parameters:
      method - The method
      Returns:
      The method definition builder
      Since:
      1.5
    • override

      @NonNull public static @NonNull MethodDef.MethodDefBuilder override(@NonNull @NonNull Constructor<?> constructor)
      Creates a constructor definition builder from Method.
      Parameters:
      constructor - The method
      Returns:
      The method definition builder
      Since:
      1.5
    • 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)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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()