• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Best practices to use properties file

 
Ranch Hand
Posts: 114
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you help me answer the following question ?

I have a xyz.properties file. This file contains properties like:

where the name of the property is 'abc.errorcode.mkd-003.useraccount' and the same name is mapped to different values, so instead of creating 3 different property files like :

I've merged them into 1 file and separated using pipelines. In my code I use string.split and collect every value in an array.

So, what is the best way to handle this ? What are the pros and cons of 3 different files and pipleines method ?

Also, does a property file name should contain all lower case letters ? Which one of the following is the best practice?


I have posted the question on another website as well. Here is the link : http://stackoverflow.com/questions/43188437/property-files-best-practices

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Properties must have a unique key (the part before the =). You cannot have three properties with the same key.

There is no reason why a properties file should only have lower-case letters, and this isn't a best practice either.
 
Tiya Khambadkone
Ranch Hand
Posts: 114
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Any other best practices?
 
Tiya Khambadkone
Ranch Hand
Posts: 114
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know when to use a property files?
What if there are 100 properties in a property file? In this case go for a property file or anything else ?
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
100 properties is not a whole lot. I've seen files hundreds of KB big, although I would not call that a best practice, either.
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic