Re: [Figleaf-developer] Validation and Observable support
Status: Alpha
Brought to you by:
steckman
|
From: <sam...@ma...> - 2004-07-11 17:47:28
|
Quoting Greg Steckman <ste...@on...>:
> > This just becomes a ChangeSet specialization - rather than a Change now
> being a
> > property->new value mapping, we now have a Change property->Array of new
> values
> > mappings - write still takes an Object, it just happens to be either a
> > Collection or an array of values.
> >
>
> Good I didn't think about the ChangeSet scheme since I wasn't working
> with that code...I'll keep working with the current scheme and then
> convert everything to use the ChangeSet API when it's ready.
>
> Greg
The code is checked it now, but I haven't made any attempt to integrate it yet -
I'd appreciate your thoughts on how it works. As it stands at the moment, we
have the following:
1. ValidationRule - uses for validating specific properties
2. Validator - takes Property->ValidationRule mappings
3. Change objects - takes Property->Value mappings
4. A ChangeSet - takes a list of Change objects
The only thing thats left is the bit of code to actually apply the ChangeSet
(think of a ChangeSet as a db transaction, with the Validator as, well, a
validation layer). I was thinking about a Mutable interface which defines the
following method:
boolean commit(ChangeSet set)
Validator could then be invoked internally like so:
boolean commit(ChangeSet set) {
if (validator.isChangeValid(set)) {
//apply changeset here
} else {
//could return false or throw validation exception, invoke callback etc.
}
}
sam
http://www.magpiebrain.com/
|