Class Method

All Implemented Interfaces:
Annotatable, Attributeable, Commentable, Erasable<Method>, Node, Renderable, WithReferences

public class Method extends ModifierSupport implements Renderable, WithReferences, Commentable, Annotatable, Erasable<Method>
  • Field Details

  • Constructor Details

  • Method Details

    • newMethod

      public static Method newMethod(String name, TypeRef returnType, boolean varArgPrefered, Property... arguments)
    • newMethod

      public static Method newMethod(String name, TypeRef returnType, Property... arguments)
    • getComments

      public List<String> getComments()
      Description copied from interface: Commentable
      Get the list of comments.
      Specified by:
      getComments in interface Commentable
      Returns:
      a List of comments.
    • getAnnotations

      public List<AnnotationRef> getAnnotations()
      Specified by:
      getAnnotations in interface Annotatable
    • isVarArgPreferred

      public boolean isVarArgPreferred()
    • getParameters

      public List<TypeParamDef> getParameters()
    • getName

      public String getName()
    • getReturnType

      public TypeRef getReturnType()
    • getArguments

      public List<Property> getArguments()
    • getExceptions

      public List<ClassRef> getExceptions()
    • isDefaultMethod

      public boolean isDefaultMethod()
    • getBlock

      public Block getBlock()
    • withErasure

      public Method withErasure()
      Description copied from interface: Erasable
      Returns an erased version of this object with generic type information removed. This creates a canonical instance that can be used for comparison and resolution.
      Specified by:
      withErasure in interface Erasable<Method>
      Returns:
      the erased version of this object
    • getErasure

      public String getErasure()
      Returns the erasure of this method as a canonical string representation. The erasure includes the method name and parameter types, providing a stable way to compare methods regardless of object instance differences.
      Specified by:
      getErasure in interface Erasable<Method>
      Returns:
      the method erasure string in the format "methodName(paramType1,paramType2,...)"
    • getReferences

      public Set<ClassRef> getReferences()
      Specified by:
      getReferences in interface WithReferences
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSignature

      public String getSignature()
    • renderDefinition

      public String renderDefinition(TypeDef enclosingType)
    • renderDefinition

      public void renderDefinition(StringBuilder sb, TypeDef enclosingType)
    • render

      public String render()
      Description copied from interface: Renderable
      Render the type into a String for the purpose of code generation. This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should be idempotent. Regarding idempotency this method may yield different result based on the context it is used even if the internal state of the object does not change. An example of such case, is a reference to class that may change based on the package from which it's refenced.
      Specified by:
      render in interface Renderable
      Returns:
      the String representation of the object as it's meant to appear in the generated code.
    • render

      public String render(TypeDef enclosingType)
    • toString

      public String toString()
      Overrides:
      toString in class Object