Class JavaVariable

java.lang.Object
org.jtool.srcmodel.JavaElement
org.jtool.srcmodel.JavaVariable
Direct Known Subclasses:
JavaField, JavaLocalVar

public abstract class JavaVariable extends JavaElement
An object representing a field, an enum-constant, a local variable, or a parameter.
  • Field Details

    • jfile

      protected final JavaFile jfile
      A file that declares this model element.
    • qname

      protected QualifiedName qname
      The fully-qualified name of this variable.
    • type

      protected String type
      The type of this variable.
    • isPrimitive

      protected boolean isPrimitive
      A flag indicating whether the type of this variable is primitive.
    • modifiers

      protected int modifiers
      The modifiers of this variable.
    • kind

      protected org.jtool.srcmodel.JavaVariable.Kind kind
      The kind of this variable.
  • Constructor Details

    • JavaVariable

      protected JavaVariable(org.eclipse.jdt.core.dom.ASTNode node, JavaFile jfile)
      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 variable
      jfile - 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

      public JavaProject getJavaProject()
      Returns the project which this class exists in.
      Specified by:
      getJavaProject in class JavaElement
      Returns:
      the project of this model element
    • getFile

      public JavaFile getFile()
      Returns the file that declares this class.
      Specified by:
      getFile in class JavaElement
      Returns:
      the declaring file
    • getQualifiedName

      public QualifiedName getQualifiedName()
      Returns the fully-qualified name of this variable.
      Specified by:
      getQualifiedName in class JavaElement
      Returns:
      the fully-qualified variable name
    • getClassName

      public String getClassName()
      Returns the name of this variable.
      Returns:
      the class name
    • getName

      public String getName()
      Returns the name of this variable.
      Returns:
      the variable name
    • getType

      public String 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, otherwise false
    • 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, otherwise false
    • isEnumConstant

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

      public boolean isLocal()
      Tests if this is a local variable.
      Returns:
      true if this is a local variable, otherwise false
    • isParameter

      public boolean isParameter()
      Tests if this is a parameter.
      Returns:
      true if this is a parameter, otherwise false
    • isFinal

      public boolean isFinal()
      Tests if this is a final variable.
      Returns:
      true if this is a final variable, otherwise false