Wednesday, May 4, 2011

PropArgs ­ Every Programmer¹s Dream



Listing 1
public static void main(String[] args)
{
      PropArgs props = new PropArgs("AppName",args,null);
Props.initStatic(props);

    props.addUsage("server", true, "<host>", "hostname");
props.addUsage("file", false, "<file name>");

  props.check(true);
 
  String server = props.get("server");
String file = props.get("file","default_file");
}

Listing 2
Boolean debug = props.getBoolean{"debug");
int size  = props.get("size",20);
Vector names = props.getVector("userlist");
Color background = PropArgsObjFactory.getColor(props.get("backcolor"));
props.put("size","100");
props.putDouble("pi",3.14159);
props.save();

No comments:

Post a Comment