• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Creating Dynamic Object

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a class to read some property File. I want whenever I will instantiate that class I will pass Array of property File Name or property Object. So that in that proprty reader I will have number of property object as I passed as argument and number argument may varry(sometimes 2 and sometimes it may be 5).

I tried as follow

//Calling class

String[] propName= {"ABC","XYZ"}; // I can pass as many number of object.
PropertyReader.getInstance(propName);

//Called Class

public static PropertyReader getInstance(String[] appCode) {
if(propertyReader == null){
propertyReader = new PropertyReader(appCode);
}
return propertyReader;
}


private PropertyReader(String[] appCode) {// I do not what to write here }


My main aim is as there are two argument as "abc" and "xyz" . there should be two Properties object by name abc and xyz should be created. the no. of object may vary depending upon the # of arguments.

If anyone has any idea please help me understand what to do here .

Rajesh

 
Sheriff
Posts: 22683
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about a Map<String,Properties>?
 
Rajesh Swain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Rob. It's working fine now with my test example. but practically my property file size would be around 150 KB. will it be a chalenge to store it in HashMap in case I have 10 entry for that particular HashMap?

Regards,
Rajesh
 
Rob Spoor
Sheriff
Posts: 22683
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
150KB of data should pose no problem at all.
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic