org.eclipse.jdt.internal.core
Class SourceField
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.jdt.internal.core.JavaElement
org.eclipse.jdt.internal.core.SourceRefElement
org.eclipse.jdt.internal.core.Member
org.eclipse.jdt.internal.core.NamedMember
org.eclipse.jdt.internal.core.SourceField
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable, IAnnotatable, IField, IJavaElement, IMember, IParent, ISourceManipulation, ISourceReference
- Direct Known Subclasses:
- ResolvedSourceField
public class SourceField
- extends NamedMember
- implements IField
- See Also:
IField
Fields inherited from class org.eclipse.jdt.internal.core.JavaElement |
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_TYPE, JEM_TYPE_PARAMETER |
Fields inherited from interface org.eclipse.jdt.core.IJavaElement |
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER |
Method Summary |
boolean |
equals(java.lang.Object o)
Returns true if this handle represents the same Java element
as the given handle. |
ASTNode |
findNode(CompilationUnit ast)
Returns the ASTNode that corresponds to this JavaElement
or null if there is no corresponding node. |
java.lang.Object |
getConstant()
Returns the constant value associated with this field
or null if this field has none. |
int |
getElementType()
Returns this element's kind encoded as an integer. |
java.lang.String |
getKey()
Returns the binding key for this field. |
IJavaElement |
getPrimaryElement(boolean checkOwner)
|
java.lang.String |
getTypeSignature()
Returns the type signature of this field. |
boolean |
isEnumConstant()
Returns whether this field represents an enum constant. |
boolean |
isResolved()
Returns whether this field represents a resolved field. |
JavaElement |
resolved(Binding binding)
|
Methods inherited from class org.eclipse.jdt.internal.core.Member |
findMethods, getCategories, getClassFile, getDeclaringType, getFlags, getHandleFromMemento, getJavadocRange, getNameRange, getOuterMostLocalContext, getType, getTypeRoot, isBinary, isReadOnly, readableName |
Methods inherited from class org.eclipse.jdt.internal.core.SourceRefElement |
copy, delete, getAnnotation, getAnnotations, getCompilationUnit, getCorrespondingResource, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getSourceRange, getUnderlyingResource, hasChildren, isStructureKnown, move, rename, resource |
Methods inherited from class org.eclipse.jdt.internal.core.JavaElement |
close, exists, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, getSourceMapper, hashCode, isAncestorOf, newJavaModelException, newNotPresentException, toDebugString, toString, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved |
Methods inherited from class org.eclipse.core.runtime.PlatformObject |
getAdapter |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jdt.core.IMember |
getCategories, getClassFile, getCompilationUnit, getDeclaringType, getFlags, getJavadocRange, getNameRange, getOccurrenceCount, getType, getTypeRoot, isBinary |
Methods inherited from interface org.eclipse.jdt.core.IJavaElement |
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
equals
public boolean equals(java.lang.Object o)
- Description copied from class:
JavaElement
- Returns true if this handle represents the same Java element
as the given handle. By default, two handles represent the same
element if they are identical or if they represent the same type
of element, have equal names, parents, and occurrence counts.
If a subclass has other requirements for equality, this method
must be overridden.
- Overrides:
equals
in class SourceRefElement
- See Also:
Object.equals(java.lang.Object)
findNode
public ASTNode findNode(CompilationUnit ast)
- Description copied from class:
SourceRefElement
- Returns the
ASTNode
that corresponds to this JavaElement
or null
if there is no corresponding node.
- Overrides:
findNode
in class SourceRefElement
getConstant
public java.lang.Object getConstant()
throws JavaModelException
- Description copied from interface:
IField
- Returns the constant value associated with this field
or
null
if this field has none. The field needs to be static and final to have
a constant value.
Returns an instance of the wrapper type corresponding to the the type of the field.
field type |
wrapper type |
int
|
java.lang.Integer
|
byte
|
java.lang.Byte
|
boolean
|
java.lang.Boolean
|
char
|
java.lang.Character
|
double
|
java.lang.Double
|
float
|
java.lang.Float
|
long
|
java.lang.Long
|
short
|
java.lang.Short
|
java.lang.String
|
java.lang.String
|
- Specified by:
getConstant
in interface IField
- Returns:
- the constant value associated with this field or
null
if this field has none.
- Throws:
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource- See Also:
IField
getElementType
public int getElementType()
- Description copied from interface:
IJavaElement
- Returns this element's kind encoded as an integer.
This is a handle-only method.
- Specified by:
getElementType
in interface IJavaElement
- Returns:
- the kind of element; one of the constants declared in
IJavaElement
- See Also:
IJavaElement
getKey
public java.lang.String getKey()
- Description copied from interface:
IField
- Returns the binding key for this field. A binding key is a key that uniquely
identifies this field. It allows access to generic info for parameterized
fields.
- Specified by:
getKey
in interface IField
- Returns:
- the binding key for this field
- See Also:
IBinding.getKey()
,
BindingKey
getPrimaryElement
public IJavaElement getPrimaryElement(boolean checkOwner)
- Overrides:
getPrimaryElement
in class JavaElement
getTypeSignature
public java.lang.String getTypeSignature()
throws JavaModelException
- Description copied from interface:
IField
- Returns the type signature of this field. For enum constants,
this returns the signature of the declaring enum class.
The type signature may be either unresolved (for source types)
or resolved (for binary types), and either basic (for basic types)
or rich (for parameterized types). See Signature
for details.
- Specified by:
getTypeSignature
in interface IField
- Returns:
- the type signature of this field
- Throws:
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource- See Also:
IField
isEnumConstant
public boolean isEnumConstant()
throws JavaModelException
- Description copied from interface:
IField
- Returns whether this field represents an enum constant.
- Specified by:
isEnumConstant
in interface IField
- Returns:
- whether this field represents an enum constant
- Throws:
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource
isResolved
public boolean isResolved()
- Description copied from interface:
IField
- Returns whether this field represents a resolved field.
If a field is resolved, its key contains resolved information.
- Specified by:
isResolved
in interface IField
- Returns:
- whether this field represents a resolved field.
resolved
public JavaElement resolved(Binding binding)
- Overrides:
resolved
in class JavaElement