• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Static fields in java classes from DB record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Static fields in java classes from DB record
      • From: Kieran Kelleher <email@hidden>
  • Prev by Date: Re: Problems with NSArray and iterators
  • Next by Date: No form data left for WOFileUpload
  • Previous by thread: Has anyone tried to use uPortal with WebObjects?
  • Next by thread: Re: Static fields in java classes from DB record
  • Index(es):
    • Date
    • Thread