Interface IJavaClass

All Superinterfaces:
IJavaDecompilableElement, IJavaElement

@Ser public interface IJavaClass extends IJavaDecompilableElement
Java AST interface to represent a Java class or interface. Class elements contain other classes (inner classes), fields, and methods.
  • Method Details

    • getAccessFlags

      int getAccessFlags()
      Retrieve the class access flags.
      Returns:
      access flags
    • isInner

      boolean isInner()
      Determine whether this type is an inner class.
      Returns:
      true if this type is an inner class
    • isAnonymous

      boolean isAnonymous()
      Determine whether this type is anonymous.
      Returns:
      true if this type is anonymous
    • isStatic

      boolean isStatic()
      Determine whether this type is static.
      Returns:
      true if this type is static
    • isInterface

      boolean isInterface()
      Determine whether this type is an interface.
      Returns:
      true if this type is an interface
    • isEnumeration

      boolean isEnumeration()
      Determine whether this type is an enumeration.
      Returns:
      true if this type is an enumeration
    • isAnnotation

      boolean isAnnotation()
      Determine whether this type is an annotation type.
      Returns:
      true if this type is an annotation type
    • isSynthetic

      boolean isSynthetic()
      Determine whether this type is synthetic.
      Returns:
      true if this type is synthetic
    • getName

      String getName()
      Get the type name. The name is a fully-qualified Java name, such as: Lcom/foo/Bar;
      Specified by:
      getName in interface IJavaDecompilableElement
      Returns:
      the class name
    • getType

      IJavaType getType()
      Get the class or interface type.
      Returns:
      the type
    • getSignature

      String getSignature()
      Description copied from interface: IJavaDecompilableElement
      Get this element's signature.
      Specified by:
      getSignature in interface IJavaDecompilableElement
      Returns:
      original internal signature
    • getSupertype

      IJavaType getSupertype()
      Get the super type.
      Returns:
      the superclass type, or null if there is none
    • getImplementedInterfaces

      List<IJavaType> getImplementedInterfaces()
      Get the implemented or extended interface types.
      Returns:
      implemented or extended interface types
    • getAnnotations

      List<IJavaAnnotation> getAnnotations()
      Get the annotations for this type.
      Returns:
      type annotations
    • getInnerClassSignatures

      List<String> getInnerClassSignatures()
      Retrieve the signatures of inner classes.
      Returns:
      inner class signatures
    • getInnerClasses

      List<IJavaClass> getInnerClasses()
      This convenience method is used to retrieve the list of inner classes.
      Returns:
      the list of inner classes
    • getAnonymousClassSignatures

      List<String> getAnonymousClassSignatures()
      Retrieve the signatures of anonymous classes.
      Returns:
      anonymous class signatures
    • getAnonymousClasses

      List<IJavaClass> getAnonymousClasses()
      Retrieve anonymous classes declared by this class.
      Returns:
      anonymous classes
    • getFieldSignatures

      List<String> getFieldSignatures()
      Retrieve field signatures declared by this class.
      Returns:
      field signatures
    • getFields

      List<IJavaField> getFields()
      This convenience method is used to retrieve the list of fields.
      Returns:
      the list of fields
    • getMethodsSignatures

      List<String> getMethodsSignatures()
      Retrieve method signatures declared by this class.
      Returns:
      method signatures
    • getMethods

      List<IJavaMethod> getMethods()
      This convenience method is used to retrieve the list of methods.
      Returns:
      the list of methods
    • addImport

      boolean addImport(String simplename, String signature)
      Register a class to be imported in the namespace.
      Parameters:
      simplename - simple class name
      signature - FQSS class signature
      Returns:
      true if the import was registered
    • getImport

      String getImport(String simplename)
      Get an imported class signature from its simple name.
      Parameters:
      simplename - simple class name
      Returns:
      FQSS class signature
    • generate

      void generate(JavaOutputSink out, List<IJavaExpression> newArgs, int anonStart, boolean bodyOnly)
      Generate this class.
      Parameters:
      out - output sink
      newArgs - constructor arguments for anonymous class rendering, or null
      anonStart - first anonymous-constructor argument to render
      bodyOnly - true to generate only the class body
    • duplicate

      IJavaClass 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