CommandLineArguments

Top  Previous  Next

You can model arguments passed through the command line by creating a <CommandLineArguments> container in your schema. The code generator looks for the CodeLineArguments container or container alias to implement its fromCommandLine ObjectFactory method.

 

 

<?xml version="1.0"?>
<schema packageScope="com.instymeds.directories.cmd.domain">
    <CommandLineArguments>
        <!-- this is the type -->
        <type type="set" values="Pharmacy,Prescriber">Pharmacy</type>
        <!-- this is category -->
        <category type="set" values="Daily,Weekly">Daily</category>
        <!-- this is directory date -->
        <directoryDate type="date" dateFormat="yyyyMMdd" minOccurs="0">20130101</directoryDate>
    </CommandLineArguments>
</schema>
 

 

 

In your application:

 

 

final CommandLineArguments cmd = ObjectFactory.fromCommandLine(CommandLineArguments.TYPE, args, "Directories");
 
if (cmd == null)
{
    return;
}
        
System.out.println(cmd.toXMLDocument().toString());