I'm really enjoying Igor's Wicket
Cookbook<https://www.packtpub.com/apache-wicket-cookbook/book>(hooray
for ebooks and instant delivery!)

Instead of asking Igor directly, I figure this mailing list is a better
forum.

There is an example (page 30) like the following:

        ConversionException e = new ConversionException(
                "Error converting value: " + value + " to an instance of: "
                        + Time.class.getName());
        *e.setSourceValue(value);*
        e.setVariable("inputPiece", value);
        e.setResourceKey(getClass().getSimpleName() + "." + errorKey);

My question is the purpose of 'setSourceValue()' call. I suspected it was to
leverage the converted value in validation messages, but ${input} already
has that value. Next I figured it could be used for the sub piece of a
conversion, like in parsing a time of day (11:15am) then is the minute
section was wrong (11:99am) the it would expose that specific value, but
setVariable() meets that need:

e.setVariable("inputPiece", value);

The previous line makes ${inputPiece} available in Validation messages.

So what does setSourceValue() do?

-Clint

Reply via email to