Connecting Tech Pros Worldwide Help | Site Map

Reusable lookup tables

  #1  
Old June 26th, 2007, 08:25 PM
Ronald Verbeek
Guest
 
Posts: n/a
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, Qualityand 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.
  #2  
Old June 27th, 2007, 01:05 PM
Robert Larsen
Guest
 
Posts: n/a

re: Reusable lookup tables


Ronald Verbeek wrote:
Quote:
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
  #3  
Old June 28th, 2007, 07:55 PM
Ronald Verbeek
Guest
 
Posts: n/a

re: Reusable lookup tables


Op Wed, 27 Jun 2007 09:55:14 +0200, schreef Robert Larsen:
Quote:
Ronald Verbeek wrote:
Quote:
>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
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.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
.Net frameword Resources ( vb.net , asp.net etc...) shamirza answers 0 January 17th, 2007 08:05 AM
DB2 enabled Datawarehouse Pilot Umar Reyi answers 0 June 16th, 2006 11:45 AM
Big O and algorithm to decide string A contains string B? usgog@yahoo.com answers 13 July 18th, 2005 01:02 AM