Fixed error reporting typo and added ability to parse boolean values.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@509 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-12-11 01:38:08 +00:00
parent b37cadc3d3
commit 2df834bc75
@@ -1,5 +1,5 @@
//
// $Id: ValueMarshaller.java,v 1.1 2001/11/26 23:44:40 mdb Exp $
// $Id: ValueMarshaller.java,v 1.2 2001/12/11 01:38:08 mdb Exp $
package com.samskivert.util;
@@ -27,7 +27,7 @@ public class ValueMarshaller
Parser parser = (Parser)_parsers.get(type);
if (parser == null) {
String errmsg = "Don't know how to convert strings into " +
"values of type '" + type + "].";
"values of type '" + type + "'.";
throw new Exception(errmsg);
}
return parser.parse(source);
@@ -67,6 +67,13 @@ public class ValueMarshaller
}
});
// and booleans
_parsers.put(Boolean.TYPE, new Parser() {
public Object parse (String source) throws Exception {
return Boolean.valueOf(source);
}
});
// and int arrays
_parsers.put(INT_ARRAY_PROTOTYPE.getClass(), new Parser() {
public Object parse (String source) throws Exception {