Search in sources :

Example 1 with ArrayElementValue

use of org.apache.tomcat.util.bcel.classfile.ArrayElementValue in project tomcat70 by apache.

the class ContextConfig method processAnnotationsStringArray.

protected String[] processAnnotationsStringArray(ElementValue ev) {
    ArrayList<String> values = new ArrayList<String>();
    if (ev instanceof ArrayElementValue) {
        ElementValue[] arrayValues = ((ArrayElementValue) ev).getElementValuesArray();
        for (ElementValue value : arrayValues) {
            values.add(value.stringifyValue());
        }
    } else {
        values.add(ev.stringifyValue());
    }
    String[] result = new String[values.size()];
    return values.toArray(result);
}
Also used : ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ArrayList(java.util.ArrayList) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue) ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ElementValue(org.apache.tomcat.util.bcel.classfile.ElementValue)

Example 2 with ArrayElementValue

use of org.apache.tomcat.util.bcel.classfile.ArrayElementValue in project tomcat by apache.

the class ContextConfig method processAnnotationsStringArray.

protected String[] processAnnotationsStringArray(ElementValue ev) {
    List<String> values = new ArrayList<>();
    if (ev instanceof ArrayElementValue) {
        ElementValue[] arrayValues = ((ArrayElementValue) ev).getElementValuesArray();
        for (ElementValue value : arrayValues) {
            values.add(value.stringifyValue());
        }
    } else {
        values.add(ev.stringifyValue());
    }
    String[] result = new String[values.size()];
    return values.toArray(result);
}
Also used : ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ArrayList(java.util.ArrayList) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue) ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ElementValue(org.apache.tomcat.util.bcel.classfile.ElementValue)

Example 3 with ArrayElementValue

use of org.apache.tomcat.util.bcel.classfile.ArrayElementValue in project tomcat70 by apache.

the class ContextConfig method processAnnotationWebInitParams.

protected Map<String, String> processAnnotationWebInitParams(ElementValue ev) {
    Map<String, String> result = new HashMap<String, String>();
    if (ev instanceof ArrayElementValue) {
        ElementValue[] arrayValues = ((ArrayElementValue) ev).getElementValuesArray();
        for (ElementValue value : arrayValues) {
            if (value instanceof AnnotationElementValue) {
                List<ElementValuePair> evps = ((AnnotationElementValue) value).getAnnotationEntry().getElementValuePairs();
                String initParamName = null;
                String initParamValue = null;
                for (ElementValuePair evp : evps) {
                    if ("name".equals(evp.getNameString())) {
                        initParamName = evp.getValue().stringifyValue();
                    } else if ("value".equals(evp.getNameString())) {
                        initParamValue = evp.getValue().stringifyValue();
                    } else {
                    // Ignore
                    }
                }
                result.put(initParamName, initParamValue);
            }
        }
    }
    return result;
}
Also used : ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ElementValuePair(org.apache.tomcat.util.bcel.classfile.ElementValuePair) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue) ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ElementValue(org.apache.tomcat.util.bcel.classfile.ElementValue) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue)

Example 4 with ArrayElementValue

use of org.apache.tomcat.util.bcel.classfile.ArrayElementValue in project tomcat by apache.

the class ContextConfig method processAnnotationWebInitParams.

protected Map<String, String> processAnnotationWebInitParams(ElementValue ev) {
    Map<String, String> result = new HashMap<>();
    if (ev instanceof ArrayElementValue) {
        ElementValue[] arrayValues = ((ArrayElementValue) ev).getElementValuesArray();
        for (ElementValue value : arrayValues) {
            if (value instanceof AnnotationElementValue) {
                List<ElementValuePair> evps = ((AnnotationElementValue) value).getAnnotationEntry().getElementValuePairs();
                String initParamName = null;
                String initParamValue = null;
                for (ElementValuePair evp : evps) {
                    if ("name".equals(evp.getNameString())) {
                        initParamName = evp.getValue().stringifyValue();
                    } else if ("value".equals(evp.getNameString())) {
                        initParamValue = evp.getValue().stringifyValue();
                    } else {
                    // Ignore
                    }
                }
                result.put(initParamName, initParamValue);
            }
        }
    }
    return result;
}
Also used : ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ElementValuePair(org.apache.tomcat.util.bcel.classfile.ElementValuePair) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue) ArrayElementValue(org.apache.tomcat.util.bcel.classfile.ArrayElementValue) ElementValue(org.apache.tomcat.util.bcel.classfile.ElementValue) AnnotationElementValue(org.apache.tomcat.util.bcel.classfile.AnnotationElementValue)

Aggregations

AnnotationElementValue (org.apache.tomcat.util.bcel.classfile.AnnotationElementValue)4 ArrayElementValue (org.apache.tomcat.util.bcel.classfile.ArrayElementValue)4 ElementValue (org.apache.tomcat.util.bcel.classfile.ElementValue)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ElementValuePair (org.apache.tomcat.util.bcel.classfile.ElementValuePair)2