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

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

Introduction

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

Prototype

NormalAnnotation(AST ast) 

Source Link

Document

Creates a new unparented normal annotation node owned by the given AST.

Usage

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

License:Open Source License

public NormalAnnotation convert(org.eclipse.jdt.internal.compiler.ast.NormalAnnotation annotation) {
    final NormalAnnotation normalAnnotation = new NormalAnnotation(this.ast);
    setTypeNameForAnnotation(annotation, normalAnnotation);

    int start = annotation.sourceStart;
    int end = annotation.declarationSourceEnd;

    org.eclipse.jdt.internal.compiler.ast.MemberValuePair[] memberValuePairs = annotation.memberValuePairs;
    if (memberValuePairs != null) {
        for (int i = 0, max = memberValuePairs.length; i < max; i++) {
            MemberValuePair memberValuePair = convert(memberValuePairs[i]);
            int memberValuePairEnd = memberValuePair.getStartPosition() + memberValuePair.getLength() - 1;
            if (end == memberValuePairEnd) {
                normalAnnotation.setFlags(normalAnnotation.getFlags() | ASTNode.RECOVERED);
            }//from   w ww  . j a  v a2 s.c o m
            normalAnnotation.values().add(memberValuePair);
        }
    }

    normalAnnotation.setSourceRange(start, end - start + 1);
    if (this.resolveBindings) {
        recordNodes(normalAnnotation, annotation);
        normalAnnotation.resolveAnnotationBinding();
    }
    return normalAnnotation;
}