Class PropertyConstantCreator


  • public class PropertyConstantCreator
    extends Object
    • Constructor Detail

      • PropertyConstantCreator

        public PropertyConstantCreator()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws IOException
        Generates a .java file containing constants for all the keys defined in the given property-file. For the constant's name, dots (.) and Dashes (-) are replaced with an underscore (_). Also, for a camel-case an underscore is being added.
        Usage:
         PropertyConstantCreator
                        .main(new String[] { "path/to/file.properties", "org.appng.example.Constants", "target/constants" })
         
        Parameters:
        args - args[0]* - the path to the property file to use
        args[1]* - the fully qualified name of the target class to generate
        args[2]* - the output-folder for the generated class
        args[3] - the charset used to read the properties file, defaults to System.getProperty("file.encoding")
        Throws:
        IOException - if the property file can not be found or the target class can not be written
        IllegalArgumentException - if one of the parameters is missing