I'm using Apache's commons-configuration
(v 1.10) library to provide configuration values for my program. I use a CompositeConfiguration
of a SystemConfiguration
and a PropertiesConfiguration
in order to allow the users to override the properties file with java's -D
command-line argument.
The problem I'm running into is validation of the values in the configuration (ensure the value of x
is positive, for example). As near as I can tell, the commons-configuration
library (neither 1.10 nor 2.0-beta) does not provide any means of validating configuration values. Yes, you can validate an XML document that's used with XMLConfiguration
(and that's all I hear about if I try to Google an answer to this question). But that doesn't help me with any values that come from the SystemConfiguration
part of my configuration class.
So, am I missing something? Does the library provide a way to validate values that I'm missing, or is there a java library that's built on commons-configuration that provides validation capabilities? Or will I need to build it into my derivative of CompositeConfiguration
?