Package org.apache.wicket.util.convert

Examples of org.apache.wicket.util.convert.IConverter.convertToObject()


      {
        // ignore that try it the other way
      }
      // go through string to convert to the right object.
      String tmp = converter.convertToString(object, locale);
      return converter.convertToObject(tmp, locale);
    }
  }
}
View Full Code Here


    else
    {
      final IConverter converter = getConverter(getType());
      try
      {
        convertedInput = converter.convertToObject(getInput(), getLocale());
      }
      catch (ConversionException e)
      {
        ValidationError error = new ValidationError();
        if (e.getResourceKey() != null)
View Full Code Here

    final Class paramClass = parameterClasses[0];
    try
    {
      final IConverter converter = Application.get().getConverterLocator().getConverter(
          paramClass);
      final Object param = converter.convertToObject(value, locale);
      if (param == null)
      {
        throw new MarkupException("Unable to convert value '" + value + "' into "
            + paramClass + ". May be there is no converter for that type registered?");
      }
View Full Code Here

    public void testConvertEmtpyString() {
        // Wicket forms rely on converters returning null from an empty string conversion
        IConverterLocator locator = tester.getApplication().getConverterLocator();
        IConverter convert = locator.getConverter(Integer.class);
        assertNotNull(convert);
        assertNull(convert.convertToObject("", Locale.getDefault()));
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.