Class AField

All Implemented Interfaces:
Cloneable

public class AField extends ADeclaration
A field or method formal parameter.
  • Field Details

    • init

      public AExpression init
      The field's initializer.
  • Constructor Details

    • AField

      public AField(String name)
      Create an AField of the given name.
      Parameters:
      name - the name of the field or formal parameter
    • AField

      public AField(String name, TypeMirror typeMirror)
      Create an AField of the given name and type.
      Parameters:
      name - the name of the field or formal parameter
      typeMirror - javac's representation of the type of the wrapped field
    • AField

      public AField(AField field)
      Create an AField that is a copy of the given one.
      Parameters:
      field - the AField to copy
  • Method Details

    • getName

      public String getName()
      Returns the name of this field or formal parameter.
      Returns:
      the name of this field or formal parameter
    • setName

      public void setName(String newName)
      Set the name of this field or formal parameter.
      Parameters:
      newName - the new name of this field or formal parameter
    • getTypeMirror

      public TypeMirror getTypeMirror()
      Returns javac's representation of the type of this.
      Returns:
      javac's representation of the type of this
    • setTypeMirror

      public void setTypeMirror(TypeMirror typeMirror)
      Set the TypeMirror this.
      Parameters:
      typeMirror - javac's representation of the type of this
    • clone

      public AField 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
    • toString

      public String toString()
      Returns a printed representation of this.
      Overrides:
      toString in class ADeclaration
      Returns:
      a printed representation of this
    • accept

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