Package org.jtool.cfg

Class JFieldReference

Direct Known Subclasses:
JUncoveredFieldReference

public class JFieldReference extends JVariableReference
An class that represents a reference to a field or an enum constant.
  • Constructor Details

    • JFieldReference

      public JFieldReference(org.eclipse.jdt.core.dom.ASTNode node, org.eclipse.jdt.core.dom.ASTNode nameNode, org.eclipse.jdt.core.dom.IVariableBinding vbinding)
      Creates a new object that represents a reference to a field. This constructor is not intended to be invoked by clients.
      Parameters:
      node - the AST node corresponding to this reference
      nameNode - the node of the name part of this field reference
      vbinding - the variable binding information on this reference
    • JFieldReference

      public JFieldReference(org.eclipse.jdt.core.dom.ASTNode node, org.eclipse.jdt.core.dom.ASTNode nameNode, String referenceForm, org.eclipse.jdt.core.dom.IVariableBinding vbinding)
      Creates a new object that represents a reference to a field. This constructor is not intended to be invoked by clients.
      Parameters:
      node - the AST node corresponding to this reference
      nameNode - the node of the name part of this field reference
      referenceForm - the form of this reference
      vbinding - the variable binding information on this reference
    • JFieldReference

      public JFieldReference(org.eclipse.jdt.core.dom.ASTNode node, org.eclipse.jdt.core.dom.ITypeBinding tbinding)
      Creates a new object that represents a reference to a type literal. This constructor is not intended to be invoked by clients.
      Parameters:
      node - the AST node corresponding to this reference
      tbinding - the type binding information on this reference
    • JFieldReference

      public JFieldReference(org.eclipse.jdt.core.dom.ASTNode node, String className, String name, String referenceForm, String type, boolean primitive, int modifiers, boolean inProject, boolean available)
      Creates a new object that represents a reference to a field. This constructor is not intended to be invoked by clients.
      Parameters:
      node - the AST node corresponding to this reference
      className - the name of a class declaring the referenced field
      name - the name of the referenced field
      referenceForm - the form of this reference
      type - the type of the referenced field
      primitive - true if the type of the referenced field is primitive, otherwise false
      modifiers - the modifier information on the referenced field
      inProject - true if the referenced field exists in the target project, otherwise false
      available - true if this is a reference to an available field, otherwise false
    • JFieldReference

      public JFieldReference(org.eclipse.jdt.core.dom.ASTNode node, String className, String name, String referenceForm)
      Creates a new object that represents a reference to a field. This constructor is not intended to be invoked by clients.
      Parameters:
      node - the AST node corresponding to this reference
      className - the name of a class declaring the referenced field
      name - the name of the referenced field
      referenceForm - the form of this reference
  • Method Details

    • getNameNode

      public org.eclipse.jdt.core.dom.ASTNode getNameNode()
      Returns the AST node corresponding to the name of this reference.
      Returns:
      the AST node of the name part
    • changeReferenceForm

      public void changeReferenceForm(String referenceForm)
      Changes the form of the reference to a field.
      Parameters:
      referenceForm - the reference form to be set
    • isAvailable

      public boolean isAvailable()
      Tests if this reference is available.
      Overrides:
      isAvailable in class JReference
      Returns:
      true if this is a reference to an available element, otherwise false
    • setPrefix

      public void setPrefix(JVariableReference prefix)
      Returns a prefix reference located prior to this reference.
      Parameters:
      prefix - the prefix reference
    • getPrefix

      public JVariableReference getPrefix()
      Returns a prefix reference located prior to this reference.
      Overrides:
      getPrefix in class JVariableReference
      Returns:
      the prefix reference
    • isFieldAccess

      public boolean isFieldAccess()
      Tests if this is a reference to a field.
      Overrides:
      isFieldAccess in class JReference
      Returns:
      true if this is a field reference, otherwise false
    • isField

      public boolean isField()
      Tests if this is a reference to a field.
      Returns:
      true if this is a field reference, otherwise false
    • isEnumConstant

      public boolean isEnumConstant()
      Tests if this is a reference to an enum constant.
      Returns:
      true if this is an enum constant reference, otherwise false
    • isTypeLiteral

      public boolean isTypeLiteral()
      Tests if this is a reference to a type literal.
      Returns:
      true if this is a type literal reference, otherwise false
    • isThis

      public boolean isThis()
      Tests if this is a reference a field within the same class.
      Returns:
      true if this is a reference to a field within the same class, otherwise false
    • isSuper

      public boolean isSuper()
      Tests if this is a reference to a field within the parent class.
      Returns:
      true if this is a reference to a field within the parent, otherwise false
    • isStatic

      public boolean isStatic()
      Tests if this is a reference to a static field.
      Returns:
      true if this is a static field reference, otherwise false
    • isVolatile

      public boolean isVolatile()
      Tests if this is a reference to a volatile field.
      Returns:
      true if this is a volatile field reference, otherwise false
    • isTransient

      public boolean isTransient()
      Tests if this is a reference to a transient field.
      Returns:
      true if this is a transient field reference, otherwise false
    • getStartPosition

      public int getStartPosition()
      Returns the position that indicates where the code fragment for this reference begins.
      Overrides:
      getStartPosition in class JReference
      Returns:
      the index value of the position on the source code
    • toString

      public String toString()
      Obtains information on this field reference.
      Overrides:
      toString in class JVariableReference
      Returns:
      the string representing the information