Search in sources :

Example 1 with AnnotationElementValue

use of org.apache.tomcat.util.bcel.classfile.AnnotationElementValue 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

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