资 源 简 介
This uses a custom JAXB/XJC plugin that adds automatic validation to the generated Java classes. You define business objects in an XSD file, pass it through XJC and the plugin will add the validation code. It uses information in the XSD to pick up validation, and you can specify extensions to that in the XSD. The resulting Java classes check for validity when the setter is called and they reject attempts to set invalid values (this is a difference from other validation frameworks). The Java classes also expose a metadata interface to make it easy for applications to use it. Examples of metadata used by applications (particularly UI applications):
render this field only if the current user has permission to access it
display this field read-only
display a list of valid options for this field
mark this field as required
disable this submit button because not all required fields have data
The validation framework handles