List of usage examples for org.apache.wicket.util.value ValueMap remove
@Override public Object remove(final Object key)
From source file:org.hippoecm.frontend.ClassFromKeyStringResourceLoader.java
License:Apache License
@Override public String loadStringResource(final Component component, final String key, final Locale locale, final String style, final String variation) { if (key.indexOf(',') > 0) { List<String> criteria = new LinkedList<String>(); for (String subKey : key.split(",")) { criteria.add(subKey);//from ww w .j a va2 s .co m } String realKey = key.substring(0, key.indexOf(',')); ValueMap map = new ValueMap(key.substring(key.indexOf(',') + 1)); if (map.containsKey("class")) { // remove class key from map and criteria String clazz = (String) map.remove("class"); Iterator<String> iter = criteria.iterator(); while (iter.hasNext()) { if (iter.next().startsWith("class=")) { iter.remove(); break; } } // iterate while no value is found, dropping the last String value = getStringForClass(Strings.join(",", criteria.toArray(new String[criteria.size()])), locale, style, clazz); if (value != null) { return value; } } if ("exception".equals(realKey) && map.containsKey("type")) { // remove class key from map and criteria String clazz = (String) map.remove("type"); Iterator<String> iter = criteria.iterator(); while (iter.hasNext()) { if (iter.next().startsWith("type=")) { iter.remove(); break; } } // Load the properties associated with the path String value = getStringForClass(Strings.join(",", criteria.toArray(new String[criteria.size()])), locale, style, clazz); if (value != null) { return value; } } } return null; }