|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jst.ws.annotations.core.utils.AnnotationUtils
public final class AnnotationUtils
Utility class for adding, removing and updating annotations and member value pairs.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Method Summary | |
---|---|
static void |
addAnnotation(org.eclipse.jdt.core.IJavaElement javaElement,
org.eclipse.jdt.core.dom.Annotation annotation)
Adds the given Annotation to the IJavaElement . |
static void |
addImport(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.String qualifiedName)
Adds an import to the compilation unit of the given IJavaElement . |
static void |
addMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation annotation,
org.eclipse.jdt.core.dom.MemberValuePair memberValuePair)
Adds the MemberValuePair to the NormalAnnotation . |
static boolean |
compareFieldNames(org.eclipse.jdt.core.dom.FieldDeclaration fieldDeclaration,
org.eclipse.jdt.core.IField field)
Compares the FieldDeclaration and IField . |
static boolean |
compareMethods(org.eclipse.jdt.core.dom.MethodDeclaration methodDeclaration,
org.eclipse.jdt.core.IMethod method)
Compares the MethodDeclaration and IMethod . |
static boolean |
compareMethods(org.eclipse.jdt.core.dom.MethodDeclaration methodOne,
org.eclipse.jdt.core.dom.MethodDeclaration methodTwo)
Compares the two MethodDeclaration . |
static boolean |
compareMethods(com.sun.mirror.declaration.MethodDeclaration methodOne,
com.sun.mirror.declaration.MethodDeclaration methodTwo)
Compares the two MethodDeclaration . |
static boolean |
compareTypeNames(org.eclipse.jdt.core.dom.AbstractTypeDeclaration abstractTypeDeclaration,
org.eclipse.jdt.core.IType type)
Compares the AbstractTypeDeclaration and IType . |
static org.eclipse.text.edits.TextEdit |
createAddAnnotationTextEdit(org.eclipse.jdt.core.IJavaElement javaElement,
org.eclipse.jdt.core.dom.Annotation annotation)
Creates a TextEdit object representing the add annotation change to the source code of the java elements compilation unit. |
static org.eclipse.text.edits.TextEdit |
createAddImportTextEdit(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.String qualifiedName)
Creates a TextEdit object representing the add import change to the source code of the java elements compilation unit. |
static org.eclipse.text.edits.TextEdit |
createAddMemberValuePairTextEdit(org.eclipse.jdt.core.dom.NormalAnnotation annotation,
org.eclipse.jdt.core.dom.MemberValuePair memberValuePair)
Creates a TextEdit object representing the change of adding the MemberValuePair to the NormalAnnotation . |
static org.eclipse.text.edits.TextEdit |
createRemoveAnnotationTextEdit(org.eclipse.jdt.core.IJavaElement javaElement,
org.eclipse.jdt.core.dom.Annotation annotation)
Creates a TextEdit object representing the remove annotation change to the source code of the java elements compilation unit. |
static org.eclipse.text.edits.TextEdit |
createRemoveImportTextEdit(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.String qualifiedName)
Creates a TextEdit object representing the remove import change to the source code of the java elements compilation unit. |
static org.eclipse.text.edits.TextEdit |
createRemoveMemberValuePairTextEdit(org.eclipse.jdt.core.dom.NormalAnnotation annotation,
org.eclipse.jdt.core.dom.MemberValuePair memberValuePair)
Creates a TextEdit object representing the change of removing the MemberValuePair from the NormalAnnotation . |
static org.eclipse.text.edits.TextEdit |
createUpdateMemberValuePairTextEdit(org.eclipse.jdt.core.dom.MemberValuePair memberValuePair,
org.eclipse.jdt.core.dom.ASTNode value)
Creates a TextEdit object representing the change of updating the MemberValuePair with the ASTNode value. |
static org.eclipse.text.edits.TextEdit |
createUpdateSingleMemberAnnotationTextEdit(org.eclipse.jdt.core.dom.SingleMemberAnnotation annotation,
org.eclipse.jdt.core.dom.ASTNode value)
Creates a TextEdit object representing the change of updating the SingleMemberAnnotation with the ASTNode value. |
static org.eclipse.jdt.core.IAnnotation |
getAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation,
org.eclipse.jdt.core.IAnnotatable annotatable)
Returns the JDT IAnnotation that corresponds to the given Annotation class
on the IAnnotatable element. |
static com.sun.mirror.declaration.AnnotationMirror |
getAnnotation(com.sun.mirror.declaration.Declaration declaration,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Returns the AnnotationMirror that corresponds to the given Annotation class
on the Declaration . |
static org.eclipse.jdt.core.dom.Annotation |
getAnnotation(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Returns the AST Annotation that corresponds to the given Annotation class
on the IJavaElement . |
static java.lang.String |
getAnnotationName(org.eclipse.jdt.core.dom.Annotation annotation)
Returns the annotations type name. |
static java.util.List<org.eclipse.jdt.core.dom.Annotation> |
getAnnotations(org.eclipse.jdt.core.IJavaElement javaElement)
Returns a list of all the Annotation that are present on the given IJavaElement |
static com.sun.mirror.declaration.AnnotationValue |
getAnnotationValue(com.sun.mirror.declaration.AnnotationMirror mirror,
java.lang.String memberName)
Returns the AnnotationValue with the given member name that is declared within the AnnotationMirror . |
static java.lang.Object |
getAnnotationValue(org.eclipse.jdt.core.IAnnotation annotation,
java.lang.String memberName)
Returns the JDT IAnnotation member value pair value with the given member name. |
static org.eclipse.jdt.core.dom.Expression |
getAnnotationValue(org.eclipse.jdt.core.dom.NormalAnnotation normalAnnotation,
java.lang.String memberName)
Returns the NormalAnnotation member value pair value with the given member name. |
static java.lang.Boolean |
getBooleanValue(com.sun.mirror.declaration.AnnotationMirror mirror,
java.lang.String memberName)
Returns the member value with the given member name from the AnnotationMirror as a Boolean value. |
static java.lang.Boolean |
getBooleanValue(org.eclipse.jdt.core.dom.Annotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the Annotation as a Boolean value. |
static java.lang.Boolean |
getBooleanValue(org.eclipse.jdt.core.IAnnotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the IAnnotation as a Boolean value. |
static org.eclipse.jdt.core.ICompilationUnit |
getCompilationUnitFromJavaElement(org.eclipse.jdt.core.IJavaElement javaElement)
Returns a ICompilationUnit for the given IJavaElement . |
static java.lang.String |
getEnumValue(org.eclipse.jdt.core.dom.Annotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the Annotation as a String value. |
static java.lang.String |
getEnumValue(org.eclipse.jdt.core.IAnnotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the IAnnotation as a String value. |
static org.eclipse.jdt.core.dom.FieldDeclaration |
getFieldDeclaration(org.eclipse.jdt.core.IField field)
Returns the FieldDeclaration that corresponds to the given IField . |
static org.eclipse.jdt.core.ILocalVariable |
getLocalVariable(org.eclipse.jdt.core.IMethod method,
int offset)
Returns the ILocalVariable at the given offset position in the source file. |
static org.eclipse.jdt.core.ILocalVariable |
getLocalVariable(org.eclipse.jdt.core.IMethod method,
java.lang.String paramName)
Returns the ILocalVariable with the given name within the declared IMethod . |
static org.eclipse.jdt.core.dom.MemberValuePair |
getMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation normalAnnotation,
java.lang.String memberName)
Returns the MemberValuePair with the given member name from the NormalAnnotation . |
static org.eclipse.jdt.core.dom.MethodDeclaration |
getMethodDeclaration(org.eclipse.jdt.core.IMethod method)
Returns the MethodDeclaration that corresponds to the given IMethod . |
static org.eclipse.jdt.core.dom.SingleVariableDeclaration |
getSingleVariableDeclaration(org.eclipse.jdt.core.ILocalVariable javaElement)
Returns the SingleVariableDeclaration that corresponds to the given ILocalVariable . |
static java.util.List<org.eclipse.jdt.core.dom.SingleVariableDeclaration> |
getSingleVariableDeclarations(org.eclipse.jdt.core.IMethod method)
Returns a list of all the SingleVariableDeclaration for the given IMethod . |
static java.lang.String |
getStringValue(com.sun.mirror.declaration.AnnotationMirror mirror,
java.lang.String memberName)
Returns the member value with the given member name from the AnnotationMirror as a String value. |
static java.lang.String |
getStringValue(org.eclipse.jdt.core.dom.Annotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the Annotation as a String value. |
static java.lang.String |
getStringValue(org.eclipse.jdt.core.IAnnotation annotation,
java.lang.String memberName)
Returns the member value with the given member name from the IAnnotation as a String value. |
static org.eclipse.jdt.core.dom.AbstractTypeDeclaration |
getTypeDeclaration(org.eclipse.jdt.core.IType type)
Returns the AbstractTypeDeclaration that corresponds to the given IType . |
static boolean |
isAnnotationPresent(org.eclipse.jdt.core.IJavaElement javaElement,
org.eclipse.jdt.core.dom.Annotation annotation)
Checks if the given Annotation is present on the IJavaElement . |
static boolean |
isAnnotationPresent(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.String annotationName)
Checks if the annotation with the given name is present on the IJavaElement . |
static void |
removeAnnotation(org.eclipse.jdt.core.IJavaElement javaElement,
org.eclipse.jdt.core.dom.Annotation annotation)
Removes the given Annotation from the IJavaElement . |
static void |
removeImport(org.eclipse.jdt.core.IJavaElement javaElement,
java.lang.String qualifiedName)
Removes an import from the compilation unit of the given IJavaElement . |
static void |
removeMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation annotation,
org.eclipse.jdt.core.dom.MemberValuePair memberValuePair)
Removes the MemberValuePair from the NormalAnnotation . |
static void |
updateMemberValuePair(org.eclipse.jdt.core.dom.MemberValuePair memberValuePair,
org.eclipse.jdt.core.dom.ASTNode value)
Updates the MemberValuePair value with the given ASTNode . |
static void |
updateSingleMemberAnnotation(org.eclipse.jdt.core.dom.SingleMemberAnnotation annotation,
org.eclipse.jdt.core.dom.ASTNode value)
Updates the value of the SingleMemberAnnotation with the given ASTNode . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void addImport(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.String qualifiedName) throws org.eclipse.core.runtime.CoreException
IJavaElement
.
javaElement
- the java element which is used to get the compilation unit to add the import to.
The following types of java elements are supported:
qualifiedName
- the import to add.
org.eclipse.core.runtime.CoreException
- the exception is thrown if the import rewrite fails.public static void removeImport(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.String qualifiedName) throws org.eclipse.core.runtime.CoreException
IJavaElement
. The import will not be removed if the
import type is referenced on more than one annotatable element in the source code. This method
is intended to be used in conjunction with removeAnnotation(IJavaElement, Annotation)
}.
javaElement
- the java element which is used to get the compilation unit to remove the import from.
The following types of java elements are supported:
qualifiedName
- the import to remove.
org.eclipse.core.runtime.CoreException
- the exception is thrown if the import rewrite fails.public static void addAnnotation(org.eclipse.jdt.core.IJavaElement javaElement, org.eclipse.jdt.core.dom.Annotation annotation) throws org.eclipse.jdt.core.JavaModelException
Annotation
to the IJavaElement
.
javaElement
- the following types of java elements are supported:
annotation
- the annotation to add.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static void removeAnnotation(org.eclipse.jdt.core.IJavaElement javaElement, org.eclipse.jdt.core.dom.Annotation annotation) throws org.eclipse.jdt.core.JavaModelException
Annotation
from the IJavaElement
.
javaElement
- the following types of java elements are supported:
annotation
- the annotation to remove.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static void addMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation annotation, org.eclipse.jdt.core.dom.MemberValuePair memberValuePair) throws org.eclipse.jdt.core.JavaModelException
MemberValuePair
to the NormalAnnotation
.
annotation
- the normal annotation to add the member value pair to.memberValuePair
- the member value pair to add.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static void removeMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation annotation, org.eclipse.jdt.core.dom.MemberValuePair memberValuePair) throws org.eclipse.jdt.core.JavaModelException
MemberValuePair
from the NormalAnnotation
.
annotation
- the normal annotation from which to remove the member value pair.memberValuePair
- the member value pair to remove.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static void updateMemberValuePair(org.eclipse.jdt.core.dom.MemberValuePair memberValuePair, org.eclipse.jdt.core.dom.ASTNode value) throws org.eclipse.jdt.core.JavaModelException
MemberValuePair
value with the given ASTNode
.
memberValuePair
- the member value pair to update.value
- the value to set.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static void updateSingleMemberAnnotation(org.eclipse.jdt.core.dom.SingleMemberAnnotation annotation, org.eclipse.jdt.core.dom.ASTNode value) throws org.eclipse.jdt.core.JavaModelException
SingleMemberAnnotation
with the given ASTNode
.
annotation
- the single member annotation to update.value
- the value to set.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createAddImportTextEdit(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.String qualifiedName) throws org.eclipse.core.runtime.CoreException
TextEdit
object representing the add import change to the source code of the java elements compilation unit.
The compilation unit itself is not modified.
javaElement
- one of the following types of java element:
The java element will be used to create a CompilationUnit
which will in turn be used to create an ImportRewrite
.
qualifiedName
- the import to add.
org.eclipse.core.runtime.CoreException
- the exception is thrown if the import rewrite fails.public static org.eclipse.text.edits.TextEdit createRemoveImportTextEdit(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.String qualifiedName) throws org.eclipse.core.runtime.CoreException
TextEdit
object representing the remove import change to the source code of the java elements compilation unit.
The compilation unit itself is not modified. No change will be recorded if the import type is referenced on more than one an annotatable
element in the source code. This method should be called in conjunction with createRemoveAnnotationTextEdit(IJavaElement, Annotation)
}.
javaElement
- one of the following types of java element:
The java element will be used to create a CompilationUnit
which will in turn be used to create an ImportRewrite
.
qualifiedName
- the annotation import to remove.
org.eclipse.core.runtime.CoreException
- the exception is thrown if the import rewrite fails.public static org.eclipse.text.edits.TextEdit createAddAnnotationTextEdit(org.eclipse.jdt.core.IJavaElement javaElement, org.eclipse.jdt.core.dom.Annotation annotation) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the add annotation change to the source code of the java elements compilation unit.
The compilation unit itself is not modified.
javaElement
- one of the following types of java element:
annotation
- the annotation to add.
MultiTextEdit
if the given java element isn't supported.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createRemoveAnnotationTextEdit(org.eclipse.jdt.core.IJavaElement javaElement, org.eclipse.jdt.core.dom.Annotation annotation) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the remove annotation change to the source code of the java elements compilation unit.
The compilation unit itself is not modified.
javaElement
- one of the following types of java element:
annotation
- the annotation to add.
MultiTextEdit
if the given java element isn't supported.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when the underlying compilation units
buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createAddMemberValuePairTextEdit(org.eclipse.jdt.core.dom.NormalAnnotation annotation, org.eclipse.jdt.core.dom.MemberValuePair memberValuePair) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the change of adding the MemberValuePair
to the NormalAnnotation
.
The underlying compilation unit itself is not modified.
annotation
- the normal annotation to add the member value pair to.memberValuePair
- the member value pair to add.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when
the underlying compilation units buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createRemoveMemberValuePairTextEdit(org.eclipse.jdt.core.dom.NormalAnnotation annotation, org.eclipse.jdt.core.dom.MemberValuePair memberValuePair) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the change of removing the MemberValuePair
from the NormalAnnotation
.
The underlying compilation unit itself is not modified.
annotation
- the normal annotation to remove the member value pair from.memberValuePair
- the member value pair to remove.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when
the underlying compilation units buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createUpdateMemberValuePairTextEdit(org.eclipse.jdt.core.dom.MemberValuePair memberValuePair, org.eclipse.jdt.core.dom.ASTNode value) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the change of updating the MemberValuePair
with the ASTNode
value.
The underlying compilation unit itself is not modified.
memberValuePair
- the member value pair to update.value
- the value to set.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when
the underlying compilation units buffer could not be accessed.public static org.eclipse.text.edits.TextEdit createUpdateSingleMemberAnnotationTextEdit(org.eclipse.jdt.core.dom.SingleMemberAnnotation annotation, org.eclipse.jdt.core.dom.ASTNode value) throws org.eclipse.jdt.core.JavaModelException
TextEdit
object representing the change of updating the SingleMemberAnnotation
with the ASTNode
value.
The underlying compilation unit itself is not modified.
annotation
- the single memeber annotation to update.value
- the value to set.
org.eclipse.jdt.core.JavaModelException
- A JavaModelException
is thrown when
the underlying compilation units buffer could not be accessed.public static org.eclipse.jdt.core.ICompilationUnit getCompilationUnitFromJavaElement(org.eclipse.jdt.core.IJavaElement javaElement)
ICompilationUnit
for the given IJavaElement
.
javaElement
- one of the following types of java element:
public static org.eclipse.jdt.core.dom.AbstractTypeDeclaration getTypeDeclaration(org.eclipse.jdt.core.IType type)
AbstractTypeDeclaration
that corresponds to the given IType
.
type
- the type.
public static org.eclipse.jdt.core.dom.MethodDeclaration getMethodDeclaration(org.eclipse.jdt.core.IMethod method)
MethodDeclaration
that corresponds to the given IMethod
.
method
- the method
public static org.eclipse.jdt.core.dom.FieldDeclaration getFieldDeclaration(org.eclipse.jdt.core.IField field)
FieldDeclaration
that corresponds to the given IField
.
field
- the field
public static org.eclipse.jdt.core.dom.SingleVariableDeclaration getSingleVariableDeclaration(org.eclipse.jdt.core.ILocalVariable javaElement)
SingleVariableDeclaration
that corresponds to the given ILocalVariable
.
javaElement
- the local variable
public static java.lang.String getAnnotationName(org.eclipse.jdt.core.dom.Annotation annotation)
annotation
- the annotation.
public static boolean compareTypeNames(org.eclipse.jdt.core.dom.AbstractTypeDeclaration abstractTypeDeclaration, org.eclipse.jdt.core.IType type)
AbstractTypeDeclaration
and IType
.
abstractTypeDeclaration
- the type declaration.type
- the type.
true
if the names match.public static boolean compareMethods(org.eclipse.jdt.core.dom.MethodDeclaration methodDeclaration, org.eclipse.jdt.core.IMethod method)
MethodDeclaration
and IMethod
.
methodDeclaration
- the method declaration.method
- the method.
true
if the method names and parameter types match.public static boolean compareMethods(org.eclipse.jdt.core.dom.MethodDeclaration methodOne, org.eclipse.jdt.core.dom.MethodDeclaration methodTwo)
MethodDeclaration
.
methodOne
- the first method declaration.methodTwo
- the second method declaration.
true
if the method names and parameter types match.public static boolean compareMethods(com.sun.mirror.declaration.MethodDeclaration methodOne, com.sun.mirror.declaration.MethodDeclaration methodTwo)
MethodDeclaration
.
methodOne
- the first method declaration.methodTwo
- the second method declaration.
true
if the method names and parameter types match.public static boolean compareFieldNames(org.eclipse.jdt.core.dom.FieldDeclaration fieldDeclaration, org.eclipse.jdt.core.IField field)
FieldDeclaration
and IField
.
fieldDeclaration
- the field declaration.field
- the field.
true
if the field names match.public static boolean isAnnotationPresent(org.eclipse.jdt.core.IJavaElement javaElement, org.eclipse.jdt.core.dom.Annotation annotation)
Annotation
is present on the IJavaElement
.
javaElement
- one of the following types of java element:
annotation
- the annotation.
true
if the annotation is present.public static boolean isAnnotationPresent(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.String annotationName)
IJavaElement
.
javaElement
- one of the following types of java element:
annotationName
- the annotation name.
true
if the annotation is present.public static java.util.List<org.eclipse.jdt.core.dom.Annotation> getAnnotations(org.eclipse.jdt.core.IJavaElement javaElement)
Annotation
that are present on the given IJavaElement
javaElement
- one of the following types of java element:
public static java.util.List<org.eclipse.jdt.core.dom.SingleVariableDeclaration> getSingleVariableDeclarations(org.eclipse.jdt.core.IMethod method)
SingleVariableDeclaration
for the given IMethod
.
method
- the method.
public static org.eclipse.jdt.core.ILocalVariable getLocalVariable(org.eclipse.jdt.core.IMethod method, int offset)
ILocalVariable
at the given offset position in the source file.
method
- the method in which the local variable is declared.offset
- the character index of the local variable in the source file.
The offset must be >= to the start position of the node representing the local variable and
<= the nodes start position plus length.
public static org.eclipse.jdt.core.ILocalVariable getLocalVariable(org.eclipse.jdt.core.IMethod method, java.lang.String paramName)
ILocalVariable
with the given name within the declared IMethod
.
method
- the method in which the local variable is declared.paramName
- the local variable name.
public static org.eclipse.jdt.core.dom.Annotation getAnnotation(org.eclipse.jdt.core.IJavaElement javaElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Annotation
that corresponds to the given Annotation
class
on the IJavaElement
.
javaElement
- one of the following types of java element:
annotation
- the Annotation
class.
public static com.sun.mirror.declaration.AnnotationMirror getAnnotation(com.sun.mirror.declaration.Declaration declaration, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
AnnotationMirror
that corresponds to the given Annotation
class
on the Declaration
.
declaration
- the declarationannotation
- the Annotation
class.
public static org.eclipse.jdt.core.IAnnotation getAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, org.eclipse.jdt.core.IAnnotatable annotatable) throws org.eclipse.jdt.core.JavaModelException
IAnnotation
that corresponds to the given Annotation
class
on the IAnnotatable
element.
annotation
- the Annotation
class.annotatable
- a package declaration, a type, a method, a field or a local variable in a compilation unit.
org.eclipse.jdt.core.JavaModelException
- if the annotatable element does not exist or if an exception occurs while accessing its corresponding resource.public static com.sun.mirror.declaration.AnnotationValue getAnnotationValue(com.sun.mirror.declaration.AnnotationMirror mirror, java.lang.String memberName)
AnnotationValue
with the given member name that is declared within the AnnotationMirror
.
mirror
- the annotation mirror.memberName
- the member name.
public static org.eclipse.jdt.core.dom.Expression getAnnotationValue(org.eclipse.jdt.core.dom.NormalAnnotation normalAnnotation, java.lang.String memberName)
NormalAnnotation
member value pair value with the given member name.
normalAnnotation
- the normal annotation.memberName
- the member value pair member name.
public static java.lang.Object getAnnotationValue(org.eclipse.jdt.core.IAnnotation annotation, java.lang.String memberName) throws org.eclipse.jdt.core.JavaModelException
IAnnotation
member value pair value with the given member name.
annotation
- the annotation.memberName
- the member name.
org.eclipse.jdt.core.JavaModelException
- if the annotation does not exist or if an exception occurs while accessing its corresponding resource.public static org.eclipse.jdt.core.dom.MemberValuePair getMemberValuePair(org.eclipse.jdt.core.dom.NormalAnnotation normalAnnotation, java.lang.String memberName)
MemberValuePair
with the given member name from the NormalAnnotation
.
normalAnnotation
- the normal annotation.memberName
- the member name of the member value pair to return.
public static java.lang.String getStringValue(com.sun.mirror.declaration.AnnotationMirror mirror, java.lang.String memberName)
AnnotationMirror
as a String
value.
mirror
- the annotation mirror.memberName
- the member name.
public static java.lang.String getStringValue(org.eclipse.jdt.core.dom.Annotation annotation, java.lang.String memberName)
Annotation
as a String
value.
annotation
- the AST annotation.memberName
- the member name.
public static java.lang.String getStringValue(org.eclipse.jdt.core.IAnnotation annotation, java.lang.String memberName) throws org.eclipse.jdt.core.JavaModelException
IAnnotation
as a String
value.
annotation
- the JDT annotation.memberName
- the member name.
org.eclipse.jdt.core.JavaModelException
- if the annotation does not exist or if an exception occurs while accessing
its corresponding resource.public static java.lang.Boolean getBooleanValue(com.sun.mirror.declaration.AnnotationMirror mirror, java.lang.String memberName)
AnnotationMirror
as a Boolean
value.
mirror
- the annotation mirror.memberName
- the member name.
public static java.lang.Boolean getBooleanValue(org.eclipse.jdt.core.dom.Annotation annotation, java.lang.String memberName)
Annotation
as a Boolean
value.
annotation
- the AST annotation.memberName
- the member name.
public static java.lang.Boolean getBooleanValue(org.eclipse.jdt.core.IAnnotation annotation, java.lang.String memberName) throws org.eclipse.jdt.core.JavaModelException
IAnnotation
as a Boolean
value.
annotation
- the JDT annotation.memberName
- the member name.
org.eclipse.jdt.core.JavaModelException
- if the annotation does not exist or if an exception occurs while accessing
its corresponding resource.public static java.lang.String getEnumValue(org.eclipse.jdt.core.dom.Annotation annotation, java.lang.String memberName)
Annotation
as a String
value.
The returned String value is the name of the enum constant.
annotation
- the AST annotation.memberName
- the member name.
public static java.lang.String getEnumValue(org.eclipse.jdt.core.IAnnotation annotation, java.lang.String memberName) throws org.eclipse.jdt.core.JavaModelException
IAnnotation
as a String
value.
The returned String value is the name of the enum constant.
annotation
- the JDT annotation.memberName
- the member name.
org.eclipse.jdt.core.JavaModelException
- if the annotation does not exist or if an exception occurs while accessing
its corresponding resource.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |