Class AClass

All Implemented Interfaces:
Cloneable

public class AClass extends ADeclaration
An annotated class.
  • Field Details

  • Method Details

    • clone

      public AClass clone()
      Overrides:
      clone in class AElement
    • equals

      public boolean equals(Object o)
      Description copied from class: AElement
      Returns true if this AElement equals o (see warnings below). Generally speaking, two AElements are equal if they are of the same type, have the same AElement.tlAnnotationsHere, and have recursively equal, corresponding subelements. Two warnings:
      • While subelement collections usually remember the order in which subelements were added and regurgitate them in this order, two AElements are equal even if order of subelements differs.
      • Two AElements are unequal if one has a subelement that the other does not, even if the tree of elements rooted at the subelement contains no annotations. Thus, if you want to compare the annotations, you should AElement.prune() both AElements first.
      Overrides:
      equals in class ADeclaration
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ADeclaration
    • isEmpty

      public boolean isEmpty()
      Description copied from class: AElement
      Returns true if this AElement is empty.
      Overrides:
      isEmpty in class ADeclaration
      Returns:
      true iff this is empty
    • prune

      public void prune()
      Description copied from class: AElement
      Removes empty subelements of this AElement depth-first.
      Overrides:
      prune in class ADeclaration
    • toString

      public String toString()
      Overrides:
      toString in class ADeclaration
    • unparse

      public String unparse()
    • unparse

      public String unparse(String linePrefix)
    • accept

      public <R, T> R accept(ElementVisitor<R,T> v, T t)
      Specified by:
      accept in class ADeclaration
    • isEnum

      public boolean isEnum(String className)
      Returns true if the given class is an enum.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      Returns:
      true if the given class is an enum
    • isEnum

      public boolean isEnum()
      Returns true if this class is an enum.
      Returns:
      true if this class is an enum
    • markAsEnum

      public void markAsEnum(String className)
      Marks the given simple class name as an enum. This method is used to mark outer classes of this class that have not been vivified, meaning that only their names are available.

      Note that this code will misbehave if a class has the same name as its inner enum, or vice-versa, because this uses simple names.

      Parameters:
      className - the simple class name of this class or one of its outer classes
    • getEnumConstants

      public List<VariableElement> getEnumConstants()
      Returns the set of enum constants for this class, or null if this is not an enum.
      Returns:
      the enum constants, or null if this is not an enum
    • setEnumConstants

      public void setEnumConstants(List<VariableElement> enumConstants)
      Marks this class as an enum.
      Parameters:
      enumConstants - the list of enum constants for the class
    • isAnnotation

      public boolean isAnnotation(String className)
      Returns true if the given class is an annotation.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      Returns:
      true if the given class is an annotation
    • isAnnotation

      public boolean isAnnotation()
      Returns true if this class is an annotation.
      Returns:
      true if this class is an annotation
    • markAsAnnotation

      public void markAsAnnotation(String className)
      Marks the given simple name as an annotation.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      See Also:
    • isInterface

      public boolean isInterface(String className)
      Returns true if the given class is an interface.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      Returns:
      true if the given class is an interface
    • isInterface

      public boolean isInterface()
      Returns true if this class is an interface.
      Returns:
      true if this class is an interface
    • markAsInterface

      public void markAsInterface(String className)
      Marks the given simple name as an interface.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      See Also:
    • isRecord

      public boolean isRecord(String className)
      Returns true if the given class is an record.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      Returns:
      true if the given class is an record
    • isRecord

      public boolean isRecord()
      Returns true if this class is an record.
      Returns:
      true if this class is an record
    • markAsRecord

      public void markAsRecord(String className)
      Marks the given simple name as a record.
      Parameters:
      className - the simple class name of this class or one of its outer classes
      See Also:
    • getTypeElement

      public TypeElement getTypeElement()
      Returns the type of the class, or null if it is unknown. Callers should ensure that either:
      Returns:
      a type element representing this class
    • setTypeElement

      public void setTypeElement(TypeElement typeElement)
      Set the type element representing the class.
      Parameters:
      typeElement - the type element representing the class
    • getMethods

      public Map<String,AMethod> getMethods()
      Returns all the methods that have been vivified on a class.
      Returns:
      a map from method signature (in JVM format) to the object representing the method
    • getFields

      public Map<String,AField> getFields()
      Returns all the fields that have been vivified on a class.
      Returns:
      a map from field name to the object representing the field
    • getAnnotations

      public Collection<? extends Annotation> getAnnotations()
      Returns the annotations on the class.
      Returns:
      the annotations, directly from scenelib