List of usage examples for org.apache.wicket.util.convert ConversionException getResourceKey
public String getResourceKey()
From source file:org.wicketstuff.multitextinput.MultiTextInput.java
License:Apache License
@SuppressWarnings("unchecked") private Collection<T> convertInput(String[] inputs) { if (getType() == null) { try {/*from w w w. j av a 2 s .c o m*/ return convertValue(inputs); } catch (ConversionException e) { ValidationError error = new ValidationError(); if (e.getResourceKey() != null) { error.addMessageKey(e.getResourceKey()); } if (e.getTargetType() != null) { error.addMessageKey("ConversionError." + Classes.simpleName(e.getTargetType())); } error.addMessageKey("ConversionError"); reportValidationError(e, error); } } else { final IConverter<Collection<T>> converter = getConverter(getType()); String curInput = ""; try { Collection<T> convertedInput = new ArrayList<T>(); if (inputs != null) { for (String input : inputs) { curInput = input; // 2011.04.14. akiraly This cast does not seem okay // converter returns Collection<T> which is cast to T? convertedInput.add((T) converter.convertToObject(curInput, getLocale())); } } return convertedInput; } catch (ConversionException e) { ValidationError error = new ValidationError(); if (e.getResourceKey() != null) { error.addMessageKey(e.getResourceKey()); } String simpleName = Classes.simpleName(getType()); error.addMessageKey("IConverter." + simpleName); error.addMessageKey("IConverter"); error.setVariable("type", simpleName); error.setVariable("input", curInput); reportValidationError(e, error); } } return null; }