Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Reusable lookup tables

Thread view: 
Ronald Verbeek - 26 Jun 2007 20:19 GMT
I have to deal with several lookup tables like for example:
Quality    SpecificWeight    Hardness    TearStrength

So I would create a Quality Class to store the values for a single
record.

I know it would be possible to use a HashMap<String, Quality> and fill it
with the appropriate data. All examples I find use the main method for
this.

However I need to reuse the same lookup tables for different
applications. So my idea is to put this lookup tables in a library jar
file that can be shared by this applications.

What is the best approach?

Regards,

Ronald.
Robert Larsen - 27 Jun 2007 08:55 GMT
> What is the best approach?
>
> Regards,
>
> Ronald.
That depends. How does a Quality object look like ?
You could probably use a property file instead of hardcoding the table.

java.util.Property can read its content using an InputStream.

Best,
Robert
Ronald Verbeek - 28 Jun 2007 19:52 GMT
Op Wed, 27 Jun 2007 09:55:14 +0200, schreef Robert Larsen:

>> What is the best approach?
>>
[quoted text clipped - 8 lines]
> Best,
> Robert

Typical data lookup objects like the Quality object have a String key and
several double values and sometimes String values and the appropriate get
methods to retrieve the values.

I already found that it is possible and workable to use a static
initializer block to initialize the HashMap or TreeMap (I want some
lookups sorted for use in a JComboBox). But if someone can suggest a
better approach it is still much appreciated.

Regards,

Ronald.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.