We are using @CheckWithMultiple along with @CheckWith to perform some custom business validations on a piece of data in a value object. We would like to be able to take advantage of the substitution mechanism of AbstractCheck in our SimpleChecks, is this possible? I've already tried something like:
static class UploadingEntityCheck extends AbstractCheck implements SimpleCheck
but implementing a getter and public Map<String, String> createMessageVariables() doesn't seem to do anything. We don't need values to be passed in to the validation for these particular properties, they will be determined as part of the validation but we would like to be able to format a message based on the determined values at validation time. Is something like this supported?
could you give me a concrete example? I guess you want to use the variables in the error message template.
SimpleCheck is only evaluated by a CheckWithCheck instance which only delegates calls to its isValid method to the SimpleCheck instance but does not call any other methods on the SimpleCheck instance. To achieve what you have in mind the CheckWithCheck implementation must be extended.
I completely forgot I had posted this. I went ahead and broke the Checks we had implemented out to be full custom checks instead of just implementing SimpleCheck. It was the cleanest way to get all the functionality we need.