Example usage for org.eclipse.jdt.internal.compiler.env IBinaryElementValuePair getValue

List of usage examples for org.eclipse.jdt.internal.compiler.env IBinaryElementValuePair getValue

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env IBinaryElementValuePair getValue.

Prototype

Object getValue();

Source Link

Document

Return ClassSignature for a Class java.lang.Class .

Usage

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

License:Open Source License

public IMemberValuePair[] getMemberValuePairs() throws JavaModelException {
    Object info = getElementInfo();
    if (info instanceof AnnotationInfo)
        return ((AnnotationInfo) info).members;
    IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs();
    int length = binaryAnnotations.length;
    IMemberValuePair[] result = new IMemberValuePair[length];
    for (int i = 0; i < length; i++) {
        IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i];
        MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName()));
        memberValuePair.value = Util.getAnnotationMemberValue(this, manager, memberValuePair,
                binaryAnnotation.getValue());
        result[i] = memberValuePair;//from  w  ww  .j  a v  a  2s. c o  m
    }
    return result;
}

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

License:Open Source License

private void addBinaryAnnotation(IBinaryAnnotation annotation) {
    addAnnotationTypeReference(replace('/', '.', Signature.toCharArray(annotation.getTypeName())));
    IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs();
    if (valuePairs != null) {
        for (int j = 0, vpLength = valuePairs.length; j < vpLength; j++) {
            IBinaryElementValuePair valuePair = valuePairs[j];
            addMethodReference(valuePair.getName(), 0);
            Object pairValue = valuePair.getValue();
            addPairValue(pairValue);/*  www.  j  a  v  a  2 s .c  o m*/
        }
    }
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ClassFileMatchLocator.java

License:Open Source License

private boolean checkAnnotation(IBinaryAnnotation annotation, TypeReferencePattern pattern) {
    if (checkTypeName(pattern.simpleName, pattern.qualification,
            convertClassFileFormat(Signature.toCharArray(annotation.getTypeName())), pattern.isCaseSensitive,
            pattern.isCamelCase)) {/*w ww  .  ja  v a  2  s  .c om*/
        return true;
    }
    IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs();
    if (valuePairs != null) {
        for (int j = 0, vpLength = valuePairs.length; j < vpLength; j++) {
            IBinaryElementValuePair valuePair = valuePairs[j];
            Object pairValue = valuePair.getValue();
            if (pairValue instanceof IBinaryAnnotation) {
                if (checkAnnotation((IBinaryAnnotation) pairValue, pattern)) {
                    return true;
                }
            }
        }
    }
    return false;
}

From source file:org.eclipse.che.jdt.BinaryTypeConvector.java

License:Open Source License

private static JsonElement toJsonElementValuePair(IBinaryElementValuePair pair) {
    JsonObject object = new JsonObject();
    object.add("name",
            pair.getName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(pair.getName())));
    object.add("value", toJsonDefaultValue(pair.getValue()));
    return object;
}