Re: referencing Application classes from non-component classes
Re: referencing Application classes from non-component classes
- Subject: Re: referencing Application classes from non-component classes
- From: Art Isbell <email@hidden>
- Date: Sat, 26 Aug 2006 10:51:14 -1000
On Aug 26, 2006, at 12:24 AM, Paul Lynch wrote:
I take in a lot of settings via both the Properties file, and
settings files that I load (from plists or xml; the latter sucks
harder). But so far I have avoided doing this from the model
layer, as it goes against MVC principles. One technique to use is
to create class (sorry, static) methods in your model class for
these properties, and call them from your application constructor.
That way you don't have to feel guilty.
Another "guilt-free" approach that doesn't add a dependency on the
WO framework is to define a Java interface that includes all
Application methods that return property values. Declare that the
Application class implements this interface. Then define a model
class constructor with an argument of this interface type. When
instantiating an instance of this model class, pass the Application
object as an argument. This opaque object will then be available to
the model instance.
Aloha,
Art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden