Example usage for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration AnnotationTypeMemberDeclaration

List of usage examples for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration AnnotationTypeMemberDeclaration

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration AnnotationTypeMemberDeclaration.

Prototype

AnnotationTypeMemberDeclaration(AST ast) 

Source Link

Document

Creates a new AST node for an annotation type member declaration owned by the given AST.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public ASTNode convert(
        org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration annotationTypeMemberDeclaration) {
    checkCanceled();/*from w  ww  .  ja  v a 2  s  . co  m*/
    if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
        return null;
    }
    AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration2 = new AnnotationTypeMemberDeclaration(
            this.ast);
    setModifiers(annotationTypeMemberDeclaration2, annotationTypeMemberDeclaration);
    final SimpleName methodName = new SimpleName(this.ast);
    methodName.internalSetIdentifier(new String(annotationTypeMemberDeclaration.selector));
    int start = annotationTypeMemberDeclaration.sourceStart;
    int end = retrieveIdentifierEndPosition(start, annotationTypeMemberDeclaration.sourceEnd);
    methodName.setSourceRange(start, end - start + 1);
    annotationTypeMemberDeclaration2.setName(methodName);
    org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference = annotationTypeMemberDeclaration.returnType;
    if (typeReference != null) {
        Type returnType = convertType(typeReference);
        setTypeForMethodDeclaration(annotationTypeMemberDeclaration2, returnType, 0);
    }
    int declarationSourceStart = annotationTypeMemberDeclaration.declarationSourceStart;
    int declarationSourceEnd = annotationTypeMemberDeclaration.bodyEnd;
    annotationTypeMemberDeclaration2.setSourceRange(declarationSourceStart,
            declarationSourceEnd - declarationSourceStart + 1);
    // The javadoc comment is now got from list store in compilation unit declaration
    convert(annotationTypeMemberDeclaration.javadoc, annotationTypeMemberDeclaration2);
    org.eclipse.jdt.internal.compiler.ast.Expression memberValue = annotationTypeMemberDeclaration.defaultValue;
    if (memberValue != null) {
        annotationTypeMemberDeclaration2.setDefault(convert(memberValue));
    }
    if (this.resolveBindings) {
        recordNodes(annotationTypeMemberDeclaration2, annotationTypeMemberDeclaration);
        recordNodes(methodName, annotationTypeMemberDeclaration);
        annotationTypeMemberDeclaration2.resolveBinding();
    }
    return annotationTypeMemberDeclaration2;
}