java.lang.Object
org.palladiosimulator.protocom.lang.java.impl.JMethod
All Implemented Interfaces:
IJMethod

public class JMethod extends Object implements IJMethod
Class representing a Java method. This is a data class. Since methods are not a compilation unit, they do not inherit GeneratedFile. A JMethod without name should be handled as a constructor. TODO: Change class to @Data ?
  • Constructor Details

    • JMethod

      public JMethod()
  • Method Details

    • returnType

      public String returnType()
      Description copied from interface: IJMethod
      The name of the return type of this method. Default value is VOID.
      Specified by:
      returnType in interface IJMethod
    • name

      public String name()
      Description copied from interface: IJMethod
      The name of the method.
      Specified by:
      name in interface IJMethod
    • parameters

      public String parameters()
      Description copied from interface: IJMethod
      The flattened parameter list as a string.
      Specified by:
      parameters in interface IJMethod
    • visibilityModifier

      public String visibilityModifier()
      Description copied from interface: IJMethod
      The visibility modifier of this method. Default value is PUBLIC.
      Specified by:
      visibilityModifier in interface IJMethod
    • throwsType

      public String throwsType()
      Description copied from interface: IJMethod
      The throw statement.
      Specified by:
      throwsType in interface IJMethod
    • staticModifier

      public String staticModifier()
      Description copied from interface: IJMethod
      The static modifier. TODO: Move up.
      Specified by:
      staticModifier in interface IJMethod
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface IJMethod
    • annotations

      public Collection<? extends IJAnnotation> annotations()
      Specified by:
      annotations in interface IJMethod
    • body

      public String body()
      Description copied from interface: IJMethod
      Code of the method as a string. If not set, the method will be treated as abstract.
      Specified by:
      body in interface IJMethod
    • methodAnnotation

      public String methodAnnotation()
      Specified by:
      methodAnnotation in interface IJMethod
    • withReturnType

      public JMethod withReturnType(String returnType)
    • withName

      public JMethod withName(String name)
    • withParameters

      public JMethod withParameters(String parameters)
    • withImplementation

      public JMethod withImplementation(String implementation)
    • withVisibilityModifier

      public JMethod withVisibilityModifier(String visibility)
    • withStaticModifier

      public JMethod withStaticModifier()
    • withThrows

      public JMethod withThrows(String throwsType)
    • withMethodAnnotation

      public JMethod withMethodAnnotation(String annotation)
    • withAnnotations

      public JMethod withAnnotations(Collection<? extends IJAnnotation> annotations)