commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Chalko <n...@chalko.com>
Subject [PATCH] CLI using relection.
Date Sat, 18 Jan 2003 09:40:50 GMT
I have been doing CLI using reflection for aobut 2 years.  I converted 
my code from getopts to commons-cli, and would like to donate it to Jakarta.

The beauty of this approach is that it requres ZERO confiuration.  All 
Option objects are created by reflection.
for example
public void main (String [] args ) {
    MyClass me = new MyClass();
    ReflectionCLI cli = new ReflectionCLI(me);
    cli.applyCommandLine(args);
}


Is all it takes.

If there is a BeanInfo class additional properties are set.
argName is from the Display Name
description is from the Short Description.

I also override the meaning of "preferred" to set the Option to required.
I have included a simple JUnit test.
Please let me know what you think, and what else I need to do to get it 
accepted.

R,
Nick

Mime
View raw message