Package org.jtool.cfg
Class JFieldReference
java.lang.Object
org.jtool.cfg.JReference
org.jtool.cfg.JVariableReference
org.jtool.cfg.JFieldReference
- Direct Known Subclasses:
JUncoveredFieldReference
An class that represents a reference to a field or an enum constant.
-
Field Summary
Fields inherited from class org.jtool.cfg.JReference
astNode, codeRange, declaringClassName, declaringMethodName, enclosingClassName, enclosingMethodName, fqn, inProject, isPrimitiveType, modifiers, name, referenceForm, type
-
Constructor Summary
ConstructorsConstructorDescriptionJFieldReference
(org.eclipse.jdt.core.dom.ASTNode node, String className, String name, String referenceForm) Creates a new object that represents a reference to a field.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.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.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.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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeReferenceForm
(String referenceForm) Changes the form of the reference to a field.org.eclipse.jdt.core.dom.ASTNode
Returns the AST node corresponding to the name of this reference.Returns a prefix reference located prior to this reference.int
Returns the position that indicates where the code fragment for this reference begins.boolean
Tests if this reference is available.boolean
Tests if this is a reference to an enum constant.boolean
isField()
Tests if this is a reference to a field.boolean
Tests if this is a reference to a field.boolean
isStatic()
Tests if this is a reference to a static field.boolean
isSuper()
Tests if this is a reference to a field within the parent class.boolean
isThis()
Tests if this is a reference a field within the same class.boolean
Tests if this is a reference to a transient field.boolean
Tests if this is a reference to a type literal.boolean
Tests if this is a reference to a volatile field.void
setPrefix
(JVariableReference prefix) Returns a prefix reference located prior to this reference.toString()
Obtains information on this field reference.Methods inherited from class org.jtool.cfg.JVariableReference
isFinal, setProperties
Methods inherited from class org.jtool.cfg.JReference
equals, equals, findEnclosingClass, findEnclosingClassName, findEnclosingMethod, findEnclosingMethodName, getASTNode, getCodeRange, getDeclaringClassName, getDeclaringMethodName, getEnclosingClassName, getEnclosingElement, getEnclosingMethodName, getModifiers, getName, getParameterString, getQualifiedClassName, getQualifiedMethodName, getQualifiedName, getReceiverName, getReferenceForm, getSignature, getSignature, getType, getType, hashCode, isAliasReference, isConstructor, isDefault, isEnumConstant, isField, isInProject, isLocal, isLocalAccess, isMethod, isMethodCall, isPrimitiveType, isPrivate, isProtected, isPublic, isReturnValueReference, isUncoveredFieldReference, isUnsupportedReference, isVariableAccess, isVersatileReference, isVoidType
-
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 referencenameNode
- the node of the name part of this field referencevbinding
- 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 referencenameNode
- the node of the name part of this field referencereferenceForm
- the form of this referencevbinding
- 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 referencetbinding
- 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 referenceclassName
- the name of a class declaring the referenced fieldname
- the name of the referenced fieldreferenceForm
- the form of this referencetype
- the type of the referenced fieldprimitive
-true
if the type of the referenced field is primitive, otherwisefalse
modifiers
- the modifier information on the referenced fieldinProject
-true
if the referenced field exists in the target project, otherwisefalse
available
-true
if this is a reference to an available field, otherwisefalse
-
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 referenceclassName
- the name of a class declaring the referenced fieldname
- the name of the referenced fieldreferenceForm
- 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
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 classJReference
- Returns:
true
if this is a reference to an available element, otherwisefalse
-
setPrefix
Returns a prefix reference located prior to this reference.- Parameters:
prefix
- the prefix reference
-
getPrefix
Returns a prefix reference located prior to this reference.- Overrides:
getPrefix
in classJVariableReference
- Returns:
- the prefix reference
-
isFieldAccess
public boolean isFieldAccess()Tests if this is a reference to a field.- Overrides:
isFieldAccess
in classJReference
- Returns:
true
if this is a field reference, otherwisefalse
-
isField
public boolean isField()Tests if this is a reference to a field.- Returns:
true
if this is a field reference, otherwisefalse
-
isEnumConstant
public boolean isEnumConstant()Tests if this is a reference to an enum constant.- Returns:
true
if this is an enum constant reference, otherwisefalse
-
isTypeLiteral
public boolean isTypeLiteral()Tests if this is a reference to a type literal.- Returns:
true
if this is a type literal reference, otherwisefalse
-
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, otherwisefalse
-
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, otherwisefalse
-
isStatic
public boolean isStatic()Tests if this is a reference to a static field.- Returns:
true
if this is a static field reference, otherwisefalse
-
isVolatile
public boolean isVolatile()Tests if this is a reference to a volatile field.- Returns:
true
if this is a volatile field reference, otherwisefalse
-
isTransient
public boolean isTransient()Tests if this is a reference to a transient field.- Returns:
true
if this is a transient field reference, otherwisefalse
-
getStartPosition
public int getStartPosition()Returns the position that indicates where the code fragment for this reference begins.- Overrides:
getStartPosition
in classJReference
- Returns:
- the index value of the position on the source code
-
toString
Obtains information on this field reference.- Overrides:
toString
in classJVariableReference
- Returns:
- the string representing the information
-