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

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

Introduction

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

Prototype

long AnnotationSourceRetention

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

Click Source Link

Usage

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

License:Open Source License

private IMemberValuePair[] getRetentionPolicy(long tagBits) {
    if ((tagBits & TagBits.AnnotationRetentionMASK) == 0)
        return Annotation.NO_MEMBER_VALUE_PAIRS;
    String retention = null;//from w  ww  .jav  a  2  s  .  co m
    if ((tagBits & TagBits.AnnotationRuntimeRetention) == TagBits.AnnotationRuntimeRetention) {
        // TagBits.AnnotationRuntimeRetention combines both TagBits.AnnotationClassRetention & TagBits.AnnotationSourceRetention
        retention = new String(
                CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.'
                + new String(TypeConstants.UPPER_RUNTIME);
    } else if ((tagBits & TagBits.AnnotationSourceRetention) != 0) {
        retention = new String(
                CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.'
                + new String(TypeConstants.UPPER_SOURCE);
    } else {
        retention = new String(
                CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.'
                + new String(TypeConstants.UPPER_CLASS);
    }
    final String value = retention;
    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 addBinaryRetentionAnnotation(long bits) {
    char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY;
    addTypeReference(compoundName[compoundName.length - 1]);
    if ((bits & TagBits.AnnotationRuntimeRetention) == TagBits.AnnotationRuntimeRetention) {
        addFieldReference(TypeConstants.UPPER_RUNTIME);
    } else if ((bits & TagBits.AnnotationClassRetention) != 0) {
        addFieldReference(TypeConstants.UPPER_CLASS);
    } else if ((bits & TagBits.AnnotationSourceRetention) != 0) {
        addFieldReference(TypeConstants.UPPER_SOURCE);
    }/*from   w  w w.  j av  a  2s. c  om*/
}

From source file:org.codehaus.jdt.groovy.internal.compiler.ast.JDTAnnotationNode.java

License:Open Source License

@Override
public boolean hasSourceRetention() {
    return (annotationBinding.getAnnotationType().tagBits
            & TagBits.AnnotationSourceRetention) == TagBits.AnnotationSourceRetention;
}