Eric wins the prize for pointing out that doubles weren't valid command-line arguments. Made all primitive types parseable as command-line arguments.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@884 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
107b5d73b5
commit
fa93661133
|
|
@ -425,14 +425,30 @@ public class ParsingEngine {
|
||||||
}
|
}
|
||||||
Boolean bool = new Boolean(b);
|
Boolean bool = new Boolean(b);
|
||||||
return bool;
|
return bool;
|
||||||
|
} else if (type == Byte.TYPE) {
|
||||||
|
Byte b = Byte.valueOf(str);
|
||||||
|
return b;
|
||||||
|
} else if (type == Short.TYPE) {
|
||||||
|
Short s = Short.valueOf(str);
|
||||||
|
return s;
|
||||||
} else if (type == Integer.TYPE) {
|
} else if (type == Integer.TYPE) {
|
||||||
Integer in = Integer.valueOf(str);
|
Integer in = Integer.valueOf(str);
|
||||||
return in;
|
return in;
|
||||||
|
} else if (type == Long.TYPE) {
|
||||||
|
Long l = Long.valueOf(str);
|
||||||
|
return l;
|
||||||
} else if (type == Float.TYPE) {
|
} else if (type == Float.TYPE) {
|
||||||
Float fl = Float.valueOf(str);
|
Float fl = Float.valueOf(str);
|
||||||
return fl;
|
return fl;
|
||||||
}
|
} else if (type == Double.TYPE) {
|
||||||
else {
|
Double db = Double.valueOf(str);
|
||||||
|
return db;
|
||||||
|
} else if (type == Character.TYPE) {
|
||||||
|
if( str.trim().length() != 1 )
|
||||||
|
throw new StingException("Unable to parse argument '" + str + "' into a character.");
|
||||||
|
Character c = str.trim().charAt(0);
|
||||||
|
return c;
|
||||||
|
} else {
|
||||||
Constructor ctor = null;
|
Constructor ctor = null;
|
||||||
try {
|
try {
|
||||||
ctor = type.getConstructor(String.class);
|
ctor = type.getConstructor(String.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue