public interface IField extends IMember, IAnnotatable
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
Modifier and Type | Method and Description |
---|---|
Object |
getConstant()
Returns the constant value associated with this field
or
null if this field has none. |
String |
getElementName()
Returns the simple name of this field.
|
String |
getKey()
Returns the binding key for this field only if the given field is
resolved . |
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.
|
getCategories, getClassFile, getCompilationUnit, getDeclaringType, getFlags, getJavadocRange, getOccurrenceCount, getType, getTypeRoot, isBinary
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown
getAdapter
exists, getNameRange, getSource, getSourceRange
copy, delete, move, rename
getChildren, hasChildren
getAnnotation, getAnnotations
Object getConstant() throws JavaModelException
null
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.
null
if not availableJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourceString getElementName()
getElementName
in interface IJavaElement
String getKey()
resolved
.
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.
IBinding.getKey()
,
BindingKey
,
isResolved()
String getTypeSignature() throws JavaModelException
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.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourceSignature
boolean isEnumConstant() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourceboolean isResolved()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.