Vaadin & Joda DateTime

I am using vaadin 6.6 and joda DateTime 1.6.2 I am using the solution described in How to use DateField with the Joda DateTime property?

The value is set / obtained correctly, but, unfortunately, I get a transition exception:

The exception is the throw inside the BeanValidationValidator:

the method is JodaDateTime and the value is java.util.Date JodaTime is not assigned from the date JodaTime does not have a row 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?

+3
source share
2 answers

I have not tried this myself, but from what I can see in BeanValidationValidator, you need to expand it as well and add implicit conversions between JodaTime and java.util.Date.

At least for the BeanValidationValidator.validate (Object) method, you need to handle this transformation.

0
source

PopupDateTimeField.java PropertyConverter

0

All Articles