use of org.apache.tomcat.util.bcel.classfile.ElementValue in project tomcat by apache.
the class ContextConfig method processAnnotationsStringArray.
protected String[] processAnnotationsStringArray(ElementValue ev) {
ArrayList<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);
}
use of org.apache.tomcat.util.bcel.classfile.ElementValue 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;
}
Aggregations