JodaTime

I use vaadin 6.6 and joda DateTime 1.6.2
I use solution described at http://vaadin.com/forum/-/message_boards/view_message/371184

Value is set/get correctly, but unfortunatelly I get Conversion exception:

Exception is throw inside BeanValidationValidator:

method is JodaDateTime and value is java.util.Date.
JodaTime is not assignable from Date.
JodaTime doesn’t have String constructor.

private Object convertValue(Object value)
throws Property.ConversionException {
// Try to assign the compatible value directly
if (value == null
|| method.getType().isAssignableFrom(value.getClass())) {
return value;
} else {
try {
// Gets the string constructor
final Constructor constr = method.getType().getConstructor(
new Class[] { String.class });

return constr.newInstance(new Object[] { value.toString() });

} catch (final java.lang.Exception e) {
throw new Property.ConversionException(e);
}
}
}

Do you have some ideas???

You’re right. This solution does not seem to be compatible with the BeanValidation as such. It uses similar way of converting values as does the BeanProperty and it is limited only to String conversion. Only workaround I can think of is to override the validate method in the BeanValidationValidator and not to use the conversion if you have a JodaTime instance.