Example usage for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding getAnnotationTagBits

List of usage examples for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding getAnnotationTagBits

Introduction

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

Prototype

@Override
public long getAnnotationTagBits() 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.model.RoleModel.java

License:Open Source License

public static Lifting.InstantiationPolicy getInstantiationPolicy(ReferenceBinding roleClassBinding) {
    if ((roleClassBinding.getAnnotationTagBits() & TagBits.AnnotationInstantiation) != 0) {
        for (AnnotationBinding annotation : roleClassBinding.getAnnotations()) {
            if (annotation.getAnnotationType().id == IOTConstants.T_OrgObjectTeamsInstantiation) {
                for (ElementValuePair pair : annotation.getElementValuePairs()) {
                    if (pair.value instanceof FieldBinding) {
                        String name = String.valueOf(((FieldBinding) pair.value).name);
                        try {
                            return InstantiationPolicy.valueOf(name);
                        } catch (IllegalArgumentException iae) {
                            return InstantiationPolicy.ERROR;
                        }/*  www. ja  va  2s.  co m*/
                    }
                }
            }
        }
    }
    return InstantiationPolicy.ONDEMAND; // default
}