org.eclipse.jdt.internal.core
Class ResolvedBinaryField

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.jdt.internal.core.JavaElement
          extended by org.eclipse.jdt.internal.core.SourceRefElement
              extended by org.eclipse.jdt.internal.core.Member
                  extended by org.eclipse.jdt.internal.core.NamedMember
                      extended by org.eclipse.jdt.internal.core.BinaryMember
                          extended by org.eclipse.jdt.internal.core.ResolvedBinaryField
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IAnnotatable, IField, IJavaElement, IMember, IParent, ISourceManipulation, ISourceReference

public class ResolvedBinaryField
extends BinaryMember

Handle representing a binary field that is resolved. The uniqueKey contains the genericSignature of the resolved field. Use BindingKey to decode it.


Field Summary
 
Fields inherited from class org.eclipse.jdt.internal.core.SourceRefElement
occurrenceCount
 
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
 
Constructor Summary
ResolvedBinaryField(JavaElement parent, java.lang.String name, java.lang.String uniqueKey)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if this handle represents the same Java element as the given handle.
 IAnnotation[] getAnnotations()
          Returns the annotations for this element.
 java.lang.String getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns the Javadoc as an html source if this element has an attached javadoc, null otherwise.
 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.
 int getFlags()
          Returns the modifier flags for this member.
 java.lang.String getKey()
          Returns the binding key for this field.
 java.lang.String getKey(boolean forceOpen)
           
 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)
           
 JavaElement unresolved()
           
 
Methods inherited from class org.eclipse.jdt.internal.core.BinaryMember
copy, getCategories, getNameRange, getSourceRange, isBinary, isStructureKnown, move, rename, setContents
 
Methods inherited from class org.eclipse.jdt.internal.core.NamedMember
getElementName, getFullyQualifiedName, getTypeQualifiedName, resolveType, resolveType
 
Methods inherited from class org.eclipse.jdt.internal.core.Member
findMethods, getClassFile, getDeclaringType, getHandleFromMemento, getJavadocRange, getOuterMostLocalContext, getType, getTypeRoot, isReadOnly, readableName
 
Methods inherited from class org.eclipse.jdt.internal.core.SourceRefElement
delete, findNode, getAnnotation, getCompilationUnit, getCorrespondingResource, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getUnderlyingResource, hasChildren, resource
 
Methods inherited from class org.eclipse.jdt.internal.core.JavaElement
close, exists, getAncestor, getChildren, getChildrenOfType, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getPrimaryElement, getResource, getSchedulingRule, getSourceMapper, hashCode, isAncestorOf, newJavaModelException, newNotPresentException, toDebugString, toString, toStringInfo, toStringWithAncestors, toStringWithAncestors
 
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.IField
getElementName
 
Methods inherited from interface org.eclipse.jdt.core.IMember
getCategories, getClassFile, getCompilationUnit, getDeclaringType, getJavadocRange, getNameRange, getOccurrenceCount, getType, getTypeRoot, isBinary
 
Methods inherited from interface org.eclipse.jdt.core.IJavaElement
exists, getAncestor, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jdt.core.ISourceReference
exists, getSource, getSourceRange
 
Methods inherited from interface org.eclipse.jdt.core.ISourceManipulation
copy, delete, move, rename
 
Methods inherited from interface org.eclipse.jdt.core.IParent
getChildren, hasChildren
 
Methods inherited from interface org.eclipse.jdt.core.IAnnotatable
getAnnotation
 

Constructor Detail

ResolvedBinaryField

public ResolvedBinaryField(JavaElement parent,
                           java.lang.String name,
                           java.lang.String uniqueKey)
Method Detail

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
Overrides:
getKey in class BinaryMember
Returns:
the binding key for this field
See Also:
IBinding.getKey(), BindingKey

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.

unresolved

public JavaElement unresolved()
Overrides:
unresolved in class JavaElement

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)

getAnnotations

public IAnnotation[] getAnnotations()
                             throws JavaModelException
Description copied from interface: IAnnotatable
Returns the annotations for this element. Returns an empty array if this method has no annotations.

Specified by:
getAnnotations in interface IAnnotatable
Overrides:
getAnnotations in class SourceRefElement
Returns:
the annotations of this element, in the order declared in the source, or an empty array if none
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.

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

getFlags

public int getFlags()
             throws JavaModelException
Description copied from interface: IMember
Returns the modifier flags for this member. The flags can be examined using class Flags.

Note that only flags as indicated in the source are returned. Thus if an interface defines a method void myMethod(); the flags don't include the 'public' flag.

Specified by:
getFlags in interface IMember
Overrides:
getFlags in class Member
Returns:
the modifier flags for this member
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
See Also:
IMember

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(boolean forceOpen)
                        throws JavaModelException
Specified by:
getKey in class BinaryMember
Throws:
JavaModelException
See Also:
Binding.computeUniqueKey()

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:
Signature

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

resolved

public JavaElement resolved(Binding binding)
Overrides:
resolved in class JavaElement

getAttachedJavadoc

public java.lang.String getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor)
                                    throws JavaModelException
Description copied from interface: IJavaElement

Returns the Javadoc as an html source if this element has an attached javadoc, null otherwise.

This should be used only for binary elements. Source elements will always return null.

The encoding used to read the javadoc is the one defined by the content type of the file. If none is defined, then the project's encoding of this java element is used. If the project's encoding cannot be retrieved, then the platform encoding is used.

In case of the javadoc doesn't exist for this element, null is returned.

The html is extracted from the attached javadoc and provided as is. No transformation or validation is done.

Specified by:
getAttachedJavadoc in interface IJavaElement
Overrides:
getAttachedJavadoc in class JavaElement
Parameters:
monitor - the given progress monitor
Returns:
the extracted javadoc from the attached javadoc, null if none
Throws:
JavaModelException - if:
  • this element does not exist
  • retrieving the attached javadoc fails (timed-out, invalid URL, ...)
  • the format of the javadoc doesn't match expected standards (different anchors,...)
See Also:
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME