Package org.jtool.srcmodel
Class JavaField
java.lang.Object
org.jtool.srcmodel.JavaElement
org.jtool.srcmodel.JavaVariable
org.jtool.srcmodel.JavaField
An object representing a field.
-
Field Summary
Fields inherited from class org.jtool.srcmodel.JavaVariable
isPrimitive, jfile, kind, modifiers, qname, type
Fields inherited from class org.jtool.srcmodel.JavaElement
astNode, codeRange
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new object representing a field.Creates a new object representing a field.Creates a new object representing a field.Creates a new object representing a field. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Tests if a given field is equal to this field.Returns fields that this field accesses in its declaration.Returns fields that this field accesses in its declaration, which are enclosed in the target project.Returns fields that access this field in their declarations.Returns fields that access this field in their declarations, which are enclosed in the target project.Returns methods that access this field in its bodies.Returns methods that access this field in its bodies, which are enclosed in the target project.Returns methods that this field calls in its declaration.Returns methods that this field calls in its declaration, which are enclosed in the target project.Returns the class that declares this class.org.eclipse.jdt.core.dom.IVariableBinding
Returns the variable binding information on this field.int
hashCode()
boolean
Tests if this field has the default visibility.boolean
Tests if this field exists inside the target project, which can resent the corresponding source code.boolean
Tests if this field has the private visibility.boolean
Tests if this field has the protected visibility.boolean
isPublic()
Tests if this field has the public visibility.boolean
isStatic()
Tests if this is a static field.boolean
Tests if this is a transient field.boolean
Tests if this is a volatile field.toString()
Obtains information on this field.Methods inherited from class org.jtool.srcmodel.JavaVariable
getClassName, getFile, getJavaProject, getKind, getModifiers, getName, getQualifiedName, getType, isEnumConstant, isField, isFinal, isLocal, isParameter, isPrimitiveType
Methods inherited from class org.jtool.srcmodel.JavaElement
getASTNode, getCodeRange, getSource
-
Constructor Details
-
JavaField
public JavaField(org.eclipse.jdt.core.dom.VariableDeclaration node, JavaClass jclass) throws JavaElementException Creates a new object representing a field. This constructor is not intended to be invoked by clients.- Parameters:
node
- the AST node for this fieldjclass
- the class that declares this field- Throws:
JavaElementException
- the exception occurs when the creation of a new object fails
-
JavaField
public JavaField(org.eclipse.jdt.core.dom.VariableDeclarationFragment node, JavaClass jclass) throws JavaElementException Creates a new object representing a field. This constructor is not intended to be invoked by clients.- Parameters:
node
- the AST node for this fieldjclass
- the class that declares this field- Throws:
JavaElementException
- the exception occurs when the creation of a new object fails
-
JavaField
public JavaField(org.eclipse.jdt.core.dom.EnumConstantDeclaration node, JavaClass jclass) throws JavaElementException Creates a new object representing a field. This constructor is not intended to be invoked by clients.- Parameters:
node
- the AST node for this enum constantjclass
- the class that declares this field- Throws:
JavaElementException
- the exception occurs when the creation of a new object fails
-
JavaField
public JavaField(org.eclipse.jdt.core.dom.IVariableBinding vbinding, JavaClass jclass) throws JavaElementException Creates a new object representing a field. This constructor is not intended to be invoked by clients.- Parameters:
vbinding
- the variable binding information on this fieldjclass
- the class that declares this field- Throws:
JavaElementException
- the exception occurs when the creation of a new object fails
-
-
Method Details
-
getVariableBinding
public org.eclipse.jdt.core.dom.IVariableBinding getVariableBinding()Returns the variable binding information on this field.- Returns:
- the variable binding information
-
isInProject
public boolean isInProject()Tests if this field exists inside the target project, which can resent the corresponding source code.- Returns:
true
if this field exists inside the target project, otherwisefalse
-
getDeclaringClass
Returns the class that declares this class.- Returns:
- the declaring class, or
null
if this class is not enclosed by any class
-
isPublic
public boolean isPublic()Tests if this field has the public visibility.- Returns:
true
if this field has the public visibility, otherwisefalse
-
isProtected
public boolean isProtected()Tests if this field has the protected visibility.- Returns:
true
if this field has the protected visibility, otherwisefalse
-
isPrivate
public boolean isPrivate()Tests if this field has the private visibility.- Returns:
true
if this field has the private visibility, otherwisefalse
-
isDefault
public boolean isDefault()Tests if this field has the default visibility.- Returns:
true
if this field has the default visibility, otherwisefalse
-
isStatic
public boolean isStatic()Tests if this is a static field.- Returns:
true
if this is a static field, otherwisefalse
-
isVolatile
public boolean isVolatile()Tests if this is a volatile field.- Returns:
true
if this is a volatile field, otherwisefalse
-
isTransient
public boolean isTransient()Tests if this is a transient field.- Returns:
true
if this is a transient field, otherwisefalse
-
equals
-
equals
Tests if a given field is equal to this field.- Parameters:
jfield
- the field to be checked- Returns:
- the
true
if the given field is equal to this field
-
hashCode
public int hashCode() -
toString
Obtains information on this field. -
getAccessedFields
Returns fields that this field accesses in its declaration.- Returns:
- the collection of the accessed fields
-
getAccessingFields
Returns fields that access this field in their declarations.- Returns:
- the collection of the accessing fields
-
getAccessedFieldsInProject
Returns fields that this field accesses in its declaration, which are enclosed in the target project.- Returns:
- the collection of the accessed fields
-
getAccessingFieldsInProject
Returns fields that access this field in their declarations, which are enclosed in the target project.- Returns:
- the collection of the accessing fields
-
getCalledMethods
Returns methods that this field calls in its declaration.- Returns:
- the collection of the called methods
-
getAccessingMethods
Returns methods that access this field in its bodies.- Returns:
- the collection of the accessing methods
-
getCalledMethodsInProject
Returns methods that this field calls in its declaration, which are enclosed in the target project.- Returns:
- the collection of the called methods
-
getAccessingMethodsInProject
Returns methods that access this field in its bodies, which are enclosed in the target project.- Returns:
- the collection of the accessing methods
-