Object validation utilities. Dataman does not require the use of these utilities for validation, but offers them as a convenience. Validation rules may be specified within domain classes or may be externalized for provision through factories.

In a domain-centric system, validation is performed by domain objects rather than interfaces. Input is a two-phase process: conversion to the appropriate datatype, followed by validation of converted values. This allows validation to be type-based rather than string-based.

The starting point for this package is {@link gov.va.med.term.access.maint.validation.ObjectValidator ObjectValidator}. An object validator contains field validators and scripted validators. Field validators implement type-specific validation rules for individual fields. Cross-field and cross-object validation rules may be specified in scripted validators.

Dataman validation provides interfaces in two programmatic styles as well as an XML interface. The functional programmatic style is suitable for programmatic definition; it uses a concise, declarative syntax:

    new FieldValidator(
        Value.required(),
        Value.unique()
        );

The JavaBean style is provided for services that expect JavaBeans:

    FieldValidator v = new FieldValidator();
    v.setRequired(true);
    v.setUnique(true);

The preferred specification language is XML (DTD). Unlike the programmatic interface, however, the XML interface is not extensible.

Requirements

Each field 'f' to be validated must have a public accessor 'getF()' or 'f()'.

Competitive Comparison

Dataman's object-oriented validation is far more powerful and useful than the interface-oriented validation provided by other libraries (like Struts). Object-oriented validation can do everything interface-oriented validation can do, and much more. Moving validation to the domain object decouples validation logic from the interface, making it reusable across any interface and even independent of interface.

Some validation services explicitly support cross-field edits using an XML syntax. While this may seem like a good idea, it is awkward and limiting in practice. Dataview supports arbitrarily complex edits in the user's choice of scripting language (which could very well be XML-based). @.maintenance

Structure diagram.

Validation sequence diagram.