[configuration] how to comment / uncomment particular property in Java *.properties files

2014-04-26 Thread Shalfey

Hello,

I cannot find the functionality for commenting / uncommenting particular 
properties by their names. Let's say I have the property like this:


|app.dateFields=tranDate,expectedCloseDate,\
  closeDate,createdDate,lastModifiedDate,startDate,endDate,\
  salesEffectiveDate,shipDate,actualShipDate,ccExpireDate,\
  revecStartDate,revRecEndDate,validFrom,licenseDateUps,\
  blanketStartDateUps,blanketEndDateUps,shipDateFedEx,\
  homeDeliveryDateFedEx,dueDate,discountDate,billedDate|

I would like to use something like

|propertiesConfigurationLayout.commentProperty(app.dateFields);|

And have the commented property as a result:

|#  app.dateFields=tranDate,expectedCloseDate,\
#closeDate,createdDate,lastModifiedDate,startDate,endDate,\
#salesEffectiveDate,shipDate,actualShipDate,ccExpireDate,\
#revecStartDate,revRecEndDate,validFrom,licenseDateUps,\
#blanketStartDateUps,blanketEndDateUps,shipDateFedEx,\
#homeDeliveryDateFedEx,dueDate,discountDate,billedDate|

And I would like to do the same thing to uncomment the property I need.

Is there a way to do this in Apache Commons Configuration? Or there is 
no standard way and I have to implement it on my own?


Initially I have created the topic on stackoverflow 
http://stackoverflow.com/questions/23313323/comment-uncomment-particular-properties-in-java-properties-files-using-apach 
and only after that I've noticed the Mailing List link. Sorry for that.


Thanks in advance,

Sergey



Re: [configuration] how to comment / uncomment particular property in Java *.properties files

2014-04-26 Thread Oliver Heger
Hello,

Am 26.04.2014 18:21, schrieb Shalfey:
 Hello,
 
 I cannot find the functionality for commenting / uncommenting particular
 properties by their names. Let's say I have the property like this:
 
 |app.dateFields=tranDate,expectedCloseDate,\
   closeDate,createdDate,lastModifiedDate,startDate,endDate,\
   salesEffectiveDate,shipDate,actualShipDate,ccExpireDate,\
   revecStartDate,revRecEndDate,validFrom,licenseDateUps,\
   blanketStartDateUps,blanketEndDateUps,shipDateFedEx,\
   homeDeliveryDateFedEx,dueDate,discountDate,billedDate|
 
 I would like to use something like
 
 |propertiesConfigurationLayout.commentProperty(app.dateFields);|
 
 And have the commented property as a result:
 
 |#  app.dateFields=tranDate,expectedCloseDate,\
 #closeDate,createdDate,lastModifiedDate,startDate,endDate,\
 #salesEffectiveDate,shipDate,actualShipDate,ccExpireDate,\
 #revecStartDate,revRecEndDate,validFrom,licenseDateUps,\
 #blanketStartDateUps,blanketEndDateUps,shipDateFedEx,\
 #homeDeliveryDateFedEx,dueDate,discountDate,billedDate|
 
 And I would like to do the same thing to uncomment the property I need.
 
 Is there a way to do this in Apache Commons Configuration? Or there is
 no standard way and I have to implement it on my own?

unfortunately, this feature is not supported. The
PropertiesConfigurationLayout class records comments assigned to a
property. Such comments can be added, changed, or removed. However,
there is no way to transform a property value to a comment or vice versa.

The support for comments mainly has the goal to remain the original
layout of a properties file when it is written again using Commons
Configuration. It does not go so far that comments can be added at
arbitrary positions in the file.

I think, your use case would be an interesting feature to be added to
this library. So if you implement something on your own, it would be
great if you could share your implementation afterwards.

Thanks
Oliver

 
 Initially I have created the topic on stackoverflow
 http://stackoverflow.com/questions/23313323/comment-uncomment-particular-properties-in-java-properties-files-using-apach
 and only after that I've noticed the Mailing List link. Sorry for that.
 
 Thanks in advance,
 
 Sergey
 
 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org