I've actually implemented just this kind of thing: "rules" and
"transformations" following the pattern of actions. There is a Rule
interface and a Transformation interface with matching singlton Loaders
which cache the objects as needed. In an action you can call
RuleLoader.getInstance().eval("rulename", value);
which throws an exception if a rule is violated or
TransformationLoader.getInstance().eval("xformname", value);
which returns a transformed object.
The rule or xform names can be properties of the field set in TR.props or
something... Works great for me. If there were a Rule or Transformation
service, it could be done automagically before an action is performed... Its
not really a framework worthy implementation, but if you want to look at the
code I can send it to anyone who is interested.
../Chris
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jason van Zyl
Sent: Monday, January 29, 2001 7:32 AM
To: Turbine
Subject: Re: pp.setProperties(object) and trimming strings
> > data.getParameters().setProperties(user, transformations)
>
> -1 because this is setProperties specific.
I feel that it is setProperties specific. If it was done in
a transformation class then we would be duplicating all
the property code. Wouldn't we?
I think the setProperties(object, transformations) makes
it completely optional: if you to manually grab all the
goods yourself then getXXX() will return your data
unscathed. The transformations would specifically be
applied within the setProperties(object, transformations)
method.
What I'm thinking about primarily is automatic form
processing, maybe something that can be used in
intake. I will think about it more, but I don't
think implementing tranformXXX() in each of the
transformation classes would be very nice. I think
the type that it transforms, and the transform
method would be enough.
I used the getClass() because I thought we could use
that in setProperty as the class type is used to
retrieve the correct type, so I figured making the
transformation return the class type it operates
on would make it easy to integrate into setProperty().
jvz.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]