Package org.jtool.srcmodel
Class JavaVariable
java.lang.Object
org.jtool.srcmodel.JavaElement
org.jtool.srcmodel.JavaVariable
- Direct Known Subclasses:
JavaField
,JavaLocalVar
An object representing a field, an enum-constant, a local variable, or a parameter.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
A flag indicating whether the type of this variable is primitive.protected final JavaFile
A file that declares this model element.protected org.jtool.srcmodel.JavaVariable.Kind
The kind of this variable.protected int
The modifiers of this variable.protected QualifiedName
The fully-qualified name of this variable.protected String
The type of this variable.Fields inherited from class org.jtool.srcmodel.JavaElement
astNode, codeRange
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JavaVariable
(org.eclipse.jdt.core.dom.ASTNode node, JavaFile jfile) Creates a new object representing a variable. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of this variable.getFile()
Returns the file that declares this class.Returns the project which this class exists in.protected org.jtool.srcmodel.JavaVariable.Kind
getKind
(org.eclipse.jdt.core.dom.IVariableBinding binding) Returns the kind of a variable.int
The the value that stores information on the modifiers of this variable.getName()
Returns the name of this variable.Returns the fully-qualified name of this variable.getType()
Returns the type of this variable.boolean
Tests if this is an enum constant.boolean
isField()
Tests if this is a filed.boolean
isFinal()
Tests if this is a final variable.boolean
isLocal()
Tests if this is a local variable.boolean
Tests if this is a parameter.boolean
Tests if the type of this variable is primitive.Methods inherited from class org.jtool.srcmodel.JavaElement
getASTNode, getCodeRange, getSource
-
Field Details
-
jfile
A file that declares this model element. -
qname
The fully-qualified name of this variable. -
type
The type of this variable. -
isPrimitive
protected boolean isPrimitiveA flag indicating whether the type of this variable is primitive. -
modifiers
protected int modifiersThe modifiers of this variable. -
kind
protected org.jtool.srcmodel.JavaVariable.Kind kindThe kind of this variable.
-
-
Constructor Details
-
JavaVariable
Creates a new object representing a variable. This constructor is not intended to be invoked by clients.- Parameters:
node
- node the AST node for this variablejfile
- the file that declares this variable
-
-
Method Details
-
getKind
protected org.jtool.srcmodel.JavaVariable.Kind getKind(org.eclipse.jdt.core.dom.IVariableBinding binding) Returns the kind of a variable.- Parameters:
binding
- type binding information on the variable- Returns:
- the kind of the variable
-
getJavaProject
Returns the project which this class exists in.- Specified by:
getJavaProject
in classJavaElement
- Returns:
- the project of this model element
-
getFile
Returns the file that declares this class.- Specified by:
getFile
in classJavaElement
- Returns:
- the declaring file
-
getQualifiedName
Returns the fully-qualified name of this variable.- Specified by:
getQualifiedName
in classJavaElement
- Returns:
- the fully-qualified variable name
-
getClassName
Returns the name of this variable.- Returns:
- the class name
-
getName
Returns the name of this variable.- Returns:
- the variable name
-
getType
Returns the type of this variable.- Returns:
- the type name
-
isPrimitiveType
public boolean isPrimitiveType()Tests if the type of this variable is primitive.- Returns:
true
if the type of this variable is primitive, otherwisefalse
-
getModifiers
public int getModifiers()The the value that stores information on the modifiers of this variable.- Returns:
- the modifier value of this variable
-
isField
public boolean isField()Tests if this is a filed.- Returns:
true
if this is a field, otherwisefalse
-
isEnumConstant
public boolean isEnumConstant()Tests if this is an enum constant.- Returns:
true
if this is an enum constant, otherwisefalse
-
isLocal
public boolean isLocal()Tests if this is a local variable.- Returns:
true
if this is a local variable, otherwisefalse
-
isParameter
public boolean isParameter()Tests if this is a parameter.- Returns:
true
if this is a parameter, otherwisefalse
-
isFinal
public boolean isFinal()Tests if this is a final variable.- Returns:
true
if this is a final variable, otherwisefalse
-