32333435363738
public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() < constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); }
3637383940414243
{ return new Float(clientValue.trim()); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("number-format-exception", clientValue)); } }
4041424344454647
{ return new Long(clientValue.trim()); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("integer-format-exception", clientValue)); } }
{ return new Integer(clientValue.trim()); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("integer-format-exception", clientValue)); } }
3132333435363738
{ return new Double(clientValue.trim()); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("number-format-exception", clientValue)); } }
{ return new Byte(clientValue.trim()); } catch (NumberFormatException ex) { throw new ValidationException(messages.format("integer-format-exception", clientValue)); } }
2627282930313233
String message) throws ValidationException { try { return Currency.getInstance(clientValue); } catch (final IllegalArgumentException e) { throw new ValidationException(message); } }
2829303132333435
public URL parseClient(Field field, String clientValue, String message) throws ValidationException { try { return new URL(clientValue); } catch (MalformedURLException e) { throw new ValidationException(message); } }
24252627282930
@Persist private String event; void onValidateFormFromForm() throws ValidationException { throw new ValidationException("From event handler method."); }
4647484950515253545556
// And it gets tricky because we probably should trim spaces! if (input.equalsIgnoreCase("zero")) return 0; if (input.equalsIgnoreCase("i")) throw new ValidationException("Rational numbers only, please."); // Get the default behavior. return null; }