Klasse MethodNode

java.lang.Object
de.svws_nrw.transpiler.typescript.MethodNode

public final class MethodNode extends Object
This class is used to store the information of transpiled java methods. This information can be used to group java methods with the same name. For type script such methods must have a common method body. This can be achieved using optional parameters and union types for the implementation.
  • Konstruktordetails

  • Methodendetails

    • getReturnType

      public TypeNode getReturnType()
      Returns the return type node of this method
      Gibt zurück:
      the return type node or null for constructors
    • getName

      public String getName()
      Returns the name of this method
      Gibt zurück:
      the name of this method
    • getComment

      public String getComment()
      Returns the transpiled and indented java comment
      Gibt zurück:
      the comment
    • getAccessModifier

      public String getAccessModifier()
      Returns the access modifier of this method
      Gibt zurück:
      the access modifier
    • setAccessModifier

      public void setAccessModifier(String accessModifier)
      Sets the access modifier of this method
      Parameter:
      accessModifier - the access modifier
    • isStatic

      public boolean isStatic()
      Returns whether the mthod is static or not
      Gibt zurück:
      true if the method is static and false otherwise
    • isConstructor

      public boolean isConstructor()
      Returns whether this method is a constructor or not.
      Gibt zurück:
      true if this method is a constructor and false otherwise
    • getBody

      public String getBody()
      Returns the method body without braces.
      Gibt zurück:
      the method body.
    • setBody

      public void setBody(String body)
      Sets the method body
      Parameter:
      body - the method body
    • printHead

      public void printHead(StringBuilder sb)
      Prints the method head using the specified StringBuilder and the indent for this method. A body is not printed and the head ends with a semicolon.
      Parameter:
      sb - the StringBuilder
    • getParameterCount

      public int getParameterCount()
      Returns the number of parameters of this method.
      Gibt zurück:
      the number of parameters of this method.
    • getParameter

      public VariableNode getParameter(int i)
      Returns the name of the parameter specified by the index i
      Parameter:
      i - the index number in the parameter list
      Gibt zurück:
      the name of the parameter specified by the index i.
    • setCommonAccessModifier

      public static void setCommonAccessModifier(List<MethodNode> methods)
      Sets the less restrivtice common access modifer at the specified methods.
      Parameter:
      methods - the methods
    • printImplementation

      public static void printImplementation(StringBuilder sb, String indent, List<MethodNode> methods, String className)
      Prints the implementation of a method with multiple signatures
      Parameter:
      sb - the StringBuilder
      indent - the indent used to print the implementation
      methods - the list of methods
      className - the name of the class to be used in an enum constructor
    • print

      public void print(StringBuilder sb, String className)
      Prints the method using the specified StringBuilder and the indent for this method.
      Parameter:
      sb - the StringBuilder
      className - the name of the class to be used in an enum constructor