public class SourceField extends NamedMember implements IField
IFieldnameoccurrenceCountJEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_DELIMITER_ESCAPE, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LAMBDA_EXPRESSION, JEM_LAMBDA_METHOD, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, parentANNOTATION, 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| Modifier | Constructor and Description |
|---|---|
protected |
SourceField(JavaElement parent,
java.lang.String name)
Constructs a handle to the field with the given name in the specified type.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected char |
getHandleMementoDelimiter()
Returns the
char that marks the start of this handles
contribution to a memento. |
java.lang.String |
getKey()
Returns the binding key for this field only if the given field is
resolved. |
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) |
protected void |
toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
Debugging purposes
|
getElementName, getFullyQualifiedName, getFullyQualifiedParameterizedName, getKey, getKey, getKey, getOccurrenceCountSignature, getPackageFragment, getTypeParameters, getTypeQualifiedName, resolveType, resolveTypeareSimilarMethods, convertConstant, findMethods, getCategories, getClassFile, getDeclaringType, getFlags, getHandleFromMemento, getJavadocRange, getNameRange, getOuterMostLocalContext, getType, getTypeRoot, isBinary, isMainMethod, isReadOnly, readableNameclosing, copy, createElementInfo, delete, generateInfos, getAnnotation, getAnnotations, getCompilationUnit, getCorrespondingResource, getHandleMemento, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getSourceRange, getUnderlyingResource, hasChildren, isStructureKnown, move, rename, resource, toStringNameappendEscapedDelimiter, close, escapeMementoName, exists, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hashCode, isAncestorOf, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetElementNamegetCategories, getClassFile, getCompilationUnit, getDeclaringType, getFlags, getJavadocRange, getOccurrenceCount, getType, getTypeRoot, isBinaryexists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnownexists, getNameRange, getSource, getSourceRangecopy, delete, move, renamegetChildren, hasChildrengetAnnotation, getAnnotationsprotected SourceField(JavaElement parent, java.lang.String name)
public boolean equals(java.lang.Object o)
JavaElementIf a subclass has other requirements for equality, this method must be overridden.
equals in class SourceRefElementObject.equals(java.lang.Object)public ASTNode findNode(CompilationUnit ast)
SourceRefElementASTNode that corresponds to this JavaElement
or null if there is no corresponding node.findNode in class SourceRefElementpublic java.lang.Object getConstant()
throws JavaModelException
IFieldnull if this field has none. To have a constant value, the field needs to be
final and initialized with a compile-time constant expression.
For types from source, this currently only works if the field initializer is a literal (returns
null for more complex constant expressions).
For primitive types, returns the boxed value.
getConstant in interface IFieldnull if not availableJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIFieldpublic int getElementType()
IJavaElementgetElementType in interface IJavaElementIJavaElementIJavaElementpublic java.lang.String getKey()
IFieldresolved.
A binding key is a key that uniquely identifies this field. It allows access to generic info
for parameterized fields.
If the given field is not resolved, the returned key is simply the java element's key.
getKey in interface IFieldIBinding.getKey(),
BindingKey,
IField.isResolved()protected char getHandleMementoDelimiter()
JavaElementchar that marks the start of this handles
contribution to a memento.getHandleMementoDelimiter in class MemberJavaElement.getHandleMemento()public IJavaElement getPrimaryElement(boolean checkOwner)
getPrimaryElement in class JavaElementpublic java.lang.String getTypeSignature()
throws JavaModelException
IField
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.
getTypeSignature in interface IFieldJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIFieldpublic boolean isEnumConstant()
throws JavaModelException
IFieldisEnumConstant in interface IFieldJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourcepublic boolean isResolved()
IFieldisResolved in interface IFieldpublic JavaElement resolved(Binding binding)
resolved in class JavaElementprotected void toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
JavaElementtoStringInfo in class JavaElementshowResolvedInfo - TODO