diff --git a/projects/samskivert/src/java/com/samskivert/util/ValueMarshaller.java b/projects/samskivert/src/java/com/samskivert/util/ValueMarshaller.java index ad6a4735..21487dab 100644 --- a/projects/samskivert/src/java/com/samskivert/util/ValueMarshaller.java +++ b/projects/samskivert/src/java/com/samskivert/util/ValueMarshaller.java @@ -1,8 +1,9 @@ // -// $Id: ValueMarshaller.java,v 1.2 2001/12/11 01:38:08 mdb Exp $ +// $Id: ValueMarshaller.java,v 1.3 2002/03/08 02:07:58 mdb Exp $ package com.samskivert.util; +import java.awt.Color; import java.util.HashMap; /** @@ -87,5 +88,16 @@ public class ValueMarshaller return StringUtil.parseStringArray(source); } }); + + // and Color objects + _parsers.put(Color.class, new Parser() { + public Object parse (String source) throws Exception { + if (source.length() == 0 || source.charAt(0) != '#') { + return new Color(Integer.parseInt(source, 16)); + } else { + return new Color(Integer.parseInt(source.substring(1), 16)); + } + } + }); } }