Support long[] values.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3265 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2004-12-09 01:34:50 +00:00
parent 129f302938
commit e7ef1e3e61
2 changed files with 13 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: FieldEditor.java,v 1.12 2004/08/27 02:12:23 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -146,6 +146,9 @@ public class FieldEditor extends JPanel
} else if (_field.getType().equals(FLOAT_ARRAY_PROTO.getClass())) {
return StringUtil.parseFloatArray(_value.getText());
} else if (_field.getType().equals(LONG_ARRAY_PROTO.getClass())) {
return StringUtil.parseLongArray(_value.getText());
} else if (_field.getType().equals(Boolean.TYPE)) {
return new Boolean(_value.getText().equalsIgnoreCase("true"));
@@ -219,4 +222,5 @@ public class FieldEditor extends JPanel
protected static final String[] STRING_ARRAY_PROTO = new String[0];
protected static final int[] INT_ARRAY_PROTO = new int[0];
protected static final float[] FLOAT_ARRAY_PROTO = new float[0];
protected static final long[] LONG_ARRAY_PROTO = new long[0];
}
@@ -1,5 +1,5 @@
//
// $Id: ConfObjRegistry.java,v 1.12 2004/09/29 04:04:20 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -197,6 +197,8 @@ public class ConfObjRegistry
config.setValue(key, (int[])value);
} else if (value instanceof String[]) {
config.setValue(key, (String[])value);
} else if (value instanceof long[]) {
config.setValue(key, (long[]) value);
} else if (value instanceof DSet) {
serializeAttribute(event.getName());
} else {
@@ -253,6 +255,10 @@ public class ConfObjRegistry
String[] defval = (String[])field.get(confObj);
field.set(confObj, config.getValue(key, defval));
} else if (type.equals(LONG_ARRAY_PROTO.getClass())) {
long[] defval = (long[])field.get(confObj);
field.set(confObj, config.getValue(key, defval));
} else if (Streamable.class.isAssignableFrom(type)) {
// don't freak out if the conf is blank.
@@ -359,6 +365,7 @@ public class ConfObjRegistry
protected static final int[] INT_ARRAY_PROTO = new int[0];
protected static final float[] FLOAT_ARRAY_PROTO = new float[0];
protected static final String[] STRING_ARRAY_PROTO = new String[0];
protected static final long[] LONG_ARRAY_PROTO = new long[0];
}
/** A mapping from identifying key to config object. */