Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.core
Interface IAnnotation

All Superinterfaces:
IAdaptable, IJavaElement, ISourceReference

public interface IAnnotation
extends IJavaElement, ISourceReference

Represents an annotation on a package declaration, a type, a method, a field or a local variable in a compilation unit or a class file.

Annotations are obtained using IAnnotatable.getAnnotation(String).

Note that annotations are not children of their declaring element. To get a list of the annotations use IAnnotatable.getAnnotations().

This interface is not intended to be implemented or extended by clients.

Since:
3.4

Field Summary
 
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
  String getElementName ()
          Returns the name of this annotation.
  IMemberValuePair[] getMemberValuePairs ()
          Returns the member-value pairs of this annotation.
  ISourceRange getNameRange ()
          Returns the source range of this annotation's name, or null if this annotation does not have associated source code (for example, in a binary type).
 int getOccurrenceCount ()
          Returns the position relative to the order this annotation is defined in the source.
 
Methods inherited from interface org.eclipse.jdt.core. IJavaElement
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementType, 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
 

Method Detail

getElementName


String getElementName()
Returns the name of this annotation. If this annotation is coming from a compilation unit, this is either a simple name (e.g. for @MyAnnot, the name is "MyAnnot"), or a qualified name (e.g. for @x. y. MyAnnot, the name is "x.y.MyAnnot"). If this annotation is coming from a class file, this is always a fully qualified name.

Note that the name has been trimmed from its whitespaces. To extract the name as it appears in the source, use getNameRange().

This is a handle-only method. The annotation may or may not be present.

Specified by:
getElementName in interface IJavaElement
Returns:
the name of this annotation

getMemberValuePairs


IMemberValuePair[] getMemberValuePairs()
                                       throws 
JavaModelException
Returns the member-value pairs of this annotation. Returns an empty array if this annotation is a marker annotation. Returns a size-1 array if this annotation is a single member annotation. In this case, the member name is always "value".

Returns:
the member-value pairs of this annotation
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource

getNameRange


ISourceRange getNameRange()
                          throws 
JavaModelException
Returns the source range of this annotation's name, or null if this annotation does not have associated source code (for example, in a binary type).

Returns:
the source range of this annotation's name, or null if this annotation does not have associated source code (for example, in a binary type)
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.

getOccurrenceCount

int getOccurrenceCount()
Returns the position relative to the order this annotation is defined in the source. Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).

Two annotations ann1 and ann2 that are equal (e.g. 2 annotations with the same name on the same type) can be distinguished using their occurrence counts. If annotation ann1 appears first in the source, it will have an occurrence count of 1. If annotation ann2 appears right after annotation ann1, it will have an occurrence count of 2.

This is a handle-only method. The annotation may or may not be present.

Returns:
the position relative to the order this annotation is defined in the source

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire