Example usage for org.eclipse.jdt.core.dom IMemberValuePairBinding toString

List of usage examples for org.eclipse.jdt.core.dom IMemberValuePairBinding toString

Introduction

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

Prototype

@Override
public String toString();

Source Link

Document

Returns a string representation of this binding suitable for debugging purposes only.

Usage

From source file:edu.cmu.cs.crystal.annotations.AnnotationDatabase.java

License:Open Source License

protected List<ICrystalAnnotation> createAnnotations(IAnnotationBinding binding) {
    if (isMulti(binding)) {
        for (IMemberValuePairBinding pair : binding.getAllMemberValuePairs()) {
            Object value;//from  w  w w. ja v a  2s. c om
            if ("value".equals(pair.getName()))
                value = pair.getValue();
            else if ("annos".equals(pair.getName()))
                value = pair.getValue();
            else {
                log.warning("Ignore extra attribute in multi-annotation " + binding.getName() + ": "
                        + pair.toString());
                continue;
            }
            if (value instanceof Object[]) {
                Object[] array = (Object[]) value;
                List<ICrystalAnnotation> result = new ArrayList<ICrystalAnnotation>(array.length);
                for (Object o : array) {
                    result.add(createAnnotation((IAnnotationBinding) o));
                }
                return Collections.unmodifiableList(result);
            } else {
                // Eclipse doesn't desugar single-element arrays with omitted braces as arrays
                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=223225
                return Collections.singletonList(createAnnotation((IAnnotationBinding) value));
            }
        }
        log.warning("Couldn't find annotation array in: " + binding);
    }
    return Collections.singletonList(createAnnotation(binding));
}