Example usage for org.eclipse.jdt.internal.compiler.lookup TagBits AnnotationForMethod

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TagBits AnnotationForMethod

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup TagBits AnnotationForMethod.

Prototype

long AnnotationForMethod

To view the source code for org.eclipse.jdt.internal.compiler.lookup TagBits AnnotationForMethod.

Click Source Link

Usage

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

License:Open Source License

private IMemberValuePair[] getTargetElementTypes(long tagBits) {
    ArrayList values = new ArrayList();
    String elementType = new String(
            CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE, '.')) + '.';
    if ((tagBits & TagBits.AnnotationForType) != 0) {
        values.add(elementType + new String(TypeConstants.TYPE));
    }/*from ww  w.  j a  v a 2  s .c  o  m*/
    if ((tagBits & TagBits.AnnotationForField) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_FIELD));
    }
    if ((tagBits & TagBits.AnnotationForMethod) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_METHOD));
    }
    if ((tagBits & TagBits.AnnotationForParameter) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_PARAMETER));
    }
    if ((tagBits & TagBits.AnnotationForConstructor) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_CONSTRUCTOR));
    }
    if ((tagBits & TagBits.AnnotationForLocalVariable) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_LOCAL_VARIABLE));
    }
    if ((tagBits & TagBits.AnnotationForAnnotationType) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_ANNOTATION_TYPE));
    }
    if ((tagBits & TagBits.AnnotationForPackage) != 0) {
        values.add(elementType + new String(TypeConstants.UPPER_PACKAGE));
    }
    final Object value;
    if (values.size() == 0) {
        if ((tagBits & TagBits.AnnotationTarget) != 0)
            value = CharOperation.NO_STRINGS;
        else
            return Annotation.NO_MEMBER_VALUE_PAIRS;
    } else if (values.size() == 1) {
        value = values.get(0);
    } else {
        value = values.toArray(new String[values.size()]);
    }
    return new IMemberValuePair[] { new IMemberValuePair() {
        public int getValueKind() {
            return IMemberValuePair.K_QUALIFIED_NAME;
        }

        public Object getValue() {
            return value;
        }

        public String getMemberName() {
            return new String(TypeConstants.VALUE);
        }
    } };
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.BinaryIndexer.java

License:Open Source License

private void addBinaryTargetAnnotation(long bits) {
    char[][] compoundName = null;
    if ((bits & TagBits.AnnotationForAnnotationType) != 0) {
        compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
        addTypeReference(compoundName[compoundName.length - 1]);
        addFieldReference(TypeConstants.UPPER_ANNOTATION_TYPE);
    }//  www  . ja v a  2 s. co  m
    if ((bits & TagBits.AnnotationForConstructor) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_CONSTRUCTOR);
    }
    if ((bits & TagBits.AnnotationForField) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_FIELD);
    }
    if ((bits & TagBits.AnnotationForLocalVariable) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_LOCAL_VARIABLE);
    }
    if ((bits & TagBits.AnnotationForMethod) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_METHOD);
    }
    if ((bits & TagBits.AnnotationForPackage) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_PACKAGE);
    }
    if ((bits & TagBits.AnnotationForParameter) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.UPPER_PARAMETER);
    }
    if ((bits & TagBits.AnnotationForType) != 0) {
        if (compoundName == null) {
            compoundName = TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE;
            addTypeReference(compoundName[compoundName.length - 1]);
        }
        addFieldReference(TypeConstants.TYPE);
    }
}