users@jaxb.java.net

Re: XJC and the visitor pattern

From: Christian Schulte <cs_at_schulte.it>
Date: Mon, 26 Oct 2009 23:04:33 +0100

Aleksei Valikov schrieb:
>
> What is your task, by the way?

I am currently looking for an elegant solution to validate schema
derived classes in a way that any validation errors can be collected,
processed and presented to a user. I cannot use schema validation for
this since those exception messages are quite meaningless from a users
perspective and the ValidationEvent interface does not provide enough
information to transform it to something more meaningful. So I was
thinking of something which simply passes every object in a given graph
to some callback interface. Ideally having something else generate an
abstract base implementation containing the validation logic from the
schema (facets, uses, etc.) so that the schema constraints could be reused.

Your visitor interface looks quite promising already. I wonder if it
would be possible to get it more typesafe so that an implementor ideally
would not need to do any instance of tests. That's quite the kind of
complexity I am trying to hide.

-- 
Christian