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

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

Introduction

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

Prototype

public IMethodBinding resolveBinding() 

Source Link

Document

Resolves and returns the binding for the annotation type member declared in this declaration.

Usage

From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java

License:Open Source License

@Override
public boolean visit(final MarkerAnnotation node) {
    final ITypeBinding binding = node.resolveTypeBinding();
    if (ASTCrawler.checkForNull(binding))
        return false;
    final IElement annoteElem = ASTCrawler.convertBinding(binding);
    this.aDB.addElement(annoteElem, binding.getModifiers());

    final ASTNode annotatedNode = node.getParent();
    switch (annotatedNode.getNodeType()) {
    case ASTNode.METHOD_DECLARATION: {
        final MethodDeclaration annotatedMethod = (MethodDeclaration) annotatedNode;
        final IMethodBinding mBinding = annotatedMethod.resolveBinding();
        return this.addAnnotationRelation(annoteElem, mBinding);

    }//from  w  ww . j a v  a  2 s.c  o  m
    case ASTNode.ANNOTATION_TYPE_DECLARATION: {
        final AnnotationTypeDeclaration annotatedAnnotation = (AnnotationTypeDeclaration) annotatedNode;
        final ITypeBinding tBinding = annotatedAnnotation.resolveBinding();
        return this.addAnnotationRelation(annoteElem, tBinding);
    }
    case ASTNode.VARIABLE_DECLARATION_STATEMENT: {
        return processVariableDeclarationStatement(annoteElem, (VariableDeclarationStatement) annotatedNode);
    }
    case ASTNode.VARIABLE_DECLARATION_FRAGMENT: {
        return processVariableDeclarationFragment(annoteElem, (VariableDeclarationFragment) annotatedNode);
    }
    case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION: {
        AnnotationTypeMemberDeclaration atmd = (AnnotationTypeMemberDeclaration) annotatedNode;
        IMethodBinding methodBinding = atmd.resolveBinding();
        return this.addAnnotationRelation(annoteElem, methodBinding);
    }

    case ASTNode.PACKAGE_DECLARATION: {
        final PackageDeclaration packDecl = (PackageDeclaration) annotatedNode;
        final IPackageBinding pBinding = packDecl.resolveBinding();
        return this.addAnnotationRelation(annoteElem, pBinding);
    }

    case ASTNode.SINGLE_VARIABLE_DECLARATION: {
        final SingleVariableDeclaration svd = (SingleVariableDeclaration) annotatedNode;
        final IVariableBinding vBinding = svd.resolveBinding();
        return this.addAnnotationRelation(annoteElem, vBinding);
    }
    case ASTNode.TYPE_DECLARATION: {
        final TypeDeclaration tDecl = (TypeDeclaration) annotatedNode;
        final ITypeBinding tBinding = tDecl.resolveBinding();
        return this.addAnnotationRelation(annoteElem, tBinding);
    }
    case ASTNode.ENUM_DECLARATION: {
        final EnumDeclaration eDecl = (EnumDeclaration) annotatedNode;
        final ITypeBinding tBinding = eDecl.resolveBinding();
        return this.addAnnotationRelation(annoteElem, tBinding);
    }

    case ASTNode.FIELD_DECLARATION: {
        final FieldDeclaration fieldDecl = (FieldDeclaration) annotatedNode;
        for (final Object obj : fieldDecl.fragments()) {
            final VariableDeclarationFragment vdf = (VariableDeclarationFragment) obj;
            final IVariableBinding vBinding = vdf.resolveBinding();
            return this.addAnnotationRelation(annoteElem, vBinding);
        }
    }

    default: {
        throw new IllegalStateException("Illegal annotated node type: " + annotatedNode);
    }
    }
}

From source file:com.codenvy.ide.ext.java.server.internal.core.util.DOMFinder.java

License:Open Source License

public boolean visit(AnnotationTypeMemberDeclaration node) {
    if (found(node, node.getName()) && this.resolveBinding)
        this.foundBinding = node.resolveBinding();
    return true;//from   www . j  av  a 2 s . c o m
}

From source file:com.google.devtools.j2objc.types.BindingMapBuilder.java

License:Open Source License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    put(node, node.resolveBinding());
    return true;
}

From source file:lang.java.jdt.internal.BindingsResolver.java

License:Open Source License

public void resolveBindings(AnnotationTypeMemberDeclaration node) {
    importBinding(node.resolveBinding());
}

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 . j a  v  a  2s .  c  o  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;
}