Class JavaField


public class JavaField extends JavaVariable
An object representing a field.
  • 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 field
      jclass - 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 field
      jclass - 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 constant
      jclass - 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 field
      jclass - 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, otherwise false
    • getDeclaringClass

      public JavaClass 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, otherwise false
    • isProtected

      public boolean isProtected()
      Tests if this field has the protected visibility.
      Returns:
      true if this field has the protected visibility, otherwise false
    • isPrivate

      public boolean isPrivate()
      Tests if this field has the private visibility.
      Returns:
      true if this field has the private visibility, otherwise false
    • isDefault

      public boolean isDefault()
      Tests if this field has the default visibility.
      Returns:
      true if this field has the default visibility, otherwise false
    • isStatic

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

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(JavaField jfield)
      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()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Obtains information on this field.
      Overrides:
      toString in class Object
      Returns:
      the string representing the information
    • getAccessedFields

      public Set<JavaField> getAccessedFields()
      Returns fields that this field accesses in its declaration.
      Returns:
      the collection of the accessed fields
    • getAccessingFields

      public Set<JavaField> getAccessingFields()
      Returns fields that access this field in their declarations.
      Returns:
      the collection of the accessing fields
    • getAccessedFieldsInProject

      public Set<JavaField> 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

      public Set<JavaField> 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

      public Set<JavaMethod> getCalledMethods()
      Returns methods that this field calls in its declaration.
      Returns:
      the collection of the called methods
    • getAccessingMethods

      public Set<JavaMethod> getAccessingMethods()
      Returns methods that access this field in its bodies.
      Returns:
      the collection of the accessing methods
    • getCalledMethodsInProject

      public Set<JavaMethod> 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

      public Set<JavaMethod> getAccessingMethodsInProject()
      Returns methods that access this field in its bodies, which are enclosed in the target project.
      Returns:
      the collection of the accessing methods