Static fields in java classes from DB record
Static fields in java classes from DB record
- Subject: Static fields in java classes from DB record
- From: Florijan Stamenkovic <email@hidden>
- Date: Sat, 20 Aug 2005 14:32:29 +0200
Hi all.
In most of the apps I am working on I have some File IO handling. To
keep the logic in one place, I use utility classes for such things.
However, there are several kinds of files that I am reading or writing,
in several different locations. The absolute folder paths are stored in
the database (in a special table named DB info), so they can be easily
changeable. In this construction however, I am all the time getting the
stored folder paths and passing them to utility methods. Those utility
methods then have to check if it is a folder, if it exists, create it,
etc etc.
What I want to do is to store the paths in a static field in the FileIO
utility class (and or wherever other class where needed), set them up
once (let's say on application or session startup), by checking if
those fields are null (to disable multiple setups of the same thing).
If yes, test the start paths, create the folders, and store the file
paths into the static fields of classes where I need them. What makes
my file writing easier and more lightweight as less checking is
involved. And I always have all the start paths I need at hand.
I am not sure however, do the class definitions get loaded per
application instance, or what? In translation: in a bit more
complicated scenario, does this system create pitfalls???
Thanks in advance
Flor
_______________________________________________
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