Interface IJavaMethod

All Superinterfaces:
IJavaDecompilableElement, IJavaElement

@Ser public interface IJavaMethod extends IJavaDecompilableElement
Java AST interface to represent a Java method.
  • Method Details

    • getLabelFactory

      IJavaLabelFactory getLabelFactory()
      Returns:
    • getIdentifierManager

      IJavaIdentifierManager getIdentifierManager()
      Returns:
    • getName

      String getName()
      Get the original method name. The returned name is a simple name, without parameter, return, or type information.
      Specified by:
      getName in interface IJavaDecompilableElement
      Returns:
      the method name
    • getSignature

      String getSignature()
      Get the original method signature.
      Specified by:
      getSignature in interface IJavaDecompilableElement
      Returns:
      the method signature
    • getParameter

      IJavaDefinition getParameter(int index)
      Parameters:
      index -
      Returns:
    • getParameterCount

      int getParameterCount()
      Returns:
    • setIndexOfFirstVisibleParameter

      void setIndexOfFirstVisibleParameter(int index)
    • getIndexOfFirstVisibleParameter

      int getIndexOfFirstVisibleParameter()
      Returns:
    • getVisibleParameterCount

      int getVisibleParameterCount()
      Returns:
    • getVisibleParameters

      List<IJavaDefinition> getVisibleParameters()
    • getParameters

      List<IJavaDefinition> getParameters()
      Get the parameters of the method.

      Note: If the method is non-static, the first parameter in the list would be `this`.

      Returns:
      the list of parameters
    • markSecondParameterOuterClassReference

      void markSecondParameterOuterClassReference()
    • isSecondParameterOuterClassReference

      boolean isSecondParameterOuterClassReference()
    • getReturnType

      IJavaType getReturnType()
      Get the return type of the method.
      Returns:
      the return type
    • getBody

      IJavaBlock getBody()
      Get the body of the method.
      Returns:
      the body, null if none
    • isEmpty

      boolean isEmpty()
      Returns:
    • isConstructor

      boolean isConstructor()
    • isClassConstructor

      boolean isClassConstructor()
    • isClassInitializer

      boolean isClassInitializer()
    • getAccessFlags

      int getAccessFlags()
    • isStatic

      boolean isStatic()
      Determine whether this method is a static method.
      Returns:
      true if the method is static, false otherwise (virtual method)
    • isSynthetic

      boolean isSynthetic()
    • isAbstract

      boolean isAbstract()
    • isNative

      boolean isNative()
    • isPublic

      boolean isPublic()
    • isProtected

      boolean isProtected()
    • isPrivate

      boolean isPrivate()
    • isInner

      boolean isInner()
    • getClassType

      IJavaType getClassType()
      Get the type of the entity containing this method.
      Returns:
    • getInnerClassSignatures

      List<String> getInnerClassSignatures()
      Returns:
    • getInnerClasses

      List<IJavaClass> getInnerClasses()
      Returns:
    • getAnonymousClassSignatures

      List<String> getAnonymousClassSignatures()
      Returns:
    • getAnonymousClasses

      List<IJavaClass> getAnonymousClasses()
      Returns:
    • getMethodAnnotations

      List<IJavaAnnotation> getMethodAnnotations()
      Returns:
    • getParameterAnnotations

      List<IJavaAnnotation> getParameterAnnotations(int index)
      Returns:
    • setDefaultValue

      void setDefaultValue(IJavaExpression defaultValue)
    • getDefaultValue

      IJavaExpression getDefaultValue()
      Get the default value provided by this method if there is one.
      Returns:
      a default value or null
    • getStatements

      List<IJavaStatement> getStatements()
      Walk the tree and get the ordered list of all (non-pseudo) statements that make up the method.
      Returns:
    • deleteStatement

      boolean deleteStatement(IJavaStatement stm)
      Delete a statement by reference. This method performs a deep search within the entire method. This works because no method should contain the same statement (in the sense, same reference) twice.
      Parameters:
      stm - the statement to delete
      Returns:
      true if the statement was found and deleted
    • generate

      void generate(JavaOutputSink out, boolean bodyOnly)
    • generate

      void generate(JavaOutputSink out, int genkind)
      Parameters:
      out -
      genkind - 0= regular method; 1= just the body of the method; 2= the method is a lambda
    • toFlatList

      List<IJavaStatement> toFlatList()
      Returns:
    • fromFlatList

      void fromFlatList(List<IJavaStatement> list)
      Parameters:
      list -
    • duplicate

      IJavaMethod duplicate()
      Description copied from interface: IJavaElement
      Duplicate this element.
      Specified by:
      duplicate in interface IJavaDecompilableElement
      Specified by:
      duplicate in interface IJavaElement
      Returns:
      a (possibly) duplicated object of the same type