Use jdk1.5 notation to do away with the array type prototypes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4335 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -73,16 +73,16 @@ public class AsStringFieldEditor extends FieldEditor
|
|||||||
} else if (_field.getType().equals(String.class)) {
|
} else if (_field.getType().equals(String.class)) {
|
||||||
return text;
|
return text;
|
||||||
|
|
||||||
} else if (_field.getType().equals(STRING_ARRAY_PROTO.getClass())) {
|
} else if (_field.getType().equals(String[].class)) {
|
||||||
return StringUtil.parseStringArray(_value.getText());
|
return StringUtil.parseStringArray(_value.getText());
|
||||||
|
|
||||||
} else if (_field.getType().equals(INT_ARRAY_PROTO.getClass())) {
|
} else if (_field.getType().equals(int[].class)) {
|
||||||
return StringUtil.parseIntArray(_value.getText());
|
return StringUtil.parseIntArray(_value.getText());
|
||||||
|
|
||||||
} else if (_field.getType().equals(FLOAT_ARRAY_PROTO.getClass())) {
|
} else if (_field.getType().equals(float[].class)) {
|
||||||
return StringUtil.parseFloatArray(_value.getText());
|
return StringUtil.parseFloatArray(_value.getText());
|
||||||
|
|
||||||
} else if (_field.getType().equals(LONG_ARRAY_PROTO.getClass())) {
|
} else if (_field.getType().equals(long[].class)) {
|
||||||
return StringUtil.parseLongArray(_value.getText());
|
return StringUtil.parseLongArray(_value.getText());
|
||||||
|
|
||||||
} else if (_field.getType().equals(Boolean.TYPE)) {
|
} else if (_field.getType().equals(Boolean.TYPE)) {
|
||||||
@@ -102,9 +102,4 @@ public class AsStringFieldEditor extends FieldEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected JTextField _value;
|
protected JTextField _value;
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,19 +240,19 @@ public abstract class ConfigRegistry
|
|||||||
String defval = (String)field.get(object);
|
String defval = (String)field.get(object);
|
||||||
field.set(object, getValue(key, defval));
|
field.set(object, getValue(key, defval));
|
||||||
|
|
||||||
} else if (type.equals(INT_ARRAY_PROTO.getClass())) {
|
} else if (type.equals(int[].class)) {
|
||||||
int[] defval = (int[])field.get(object);
|
int[] defval = (int[])field.get(object);
|
||||||
field.set(object, getValue(key, defval));
|
field.set(object, getValue(key, defval));
|
||||||
|
|
||||||
} else if (type.equals(FLOAT_ARRAY_PROTO.getClass())) {
|
} else if (type.equals(float[].class)) {
|
||||||
float[] defval = (float[])field.get(object);
|
float[] defval = (float[])field.get(object);
|
||||||
field.set(object, getValue(key, defval));
|
field.set(object, getValue(key, defval));
|
||||||
|
|
||||||
} else if (type.equals(STRING_ARRAY_PROTO.getClass())) {
|
} else if (type.equals(String[].class)) {
|
||||||
String[] defval = (String[])field.get(object);
|
String[] defval = (String[])field.get(object);
|
||||||
field.set(object, getValue(key, defval));
|
field.set(object, getValue(key, defval));
|
||||||
|
|
||||||
} else if (type.equals(LONG_ARRAY_PROTO.getClass())) {
|
} else if (type.equals(long[].class)) {
|
||||||
long[] defval = (long[])field.get(object);
|
long[] defval = (long[])field.get(object);
|
||||||
field.set(object, getValue(key, defval));
|
field.set(object, getValue(key, defval));
|
||||||
|
|
||||||
@@ -367,9 +367,4 @@ public abstract class ConfigRegistry
|
|||||||
/** A mapping from identifying key to config object. */
|
/** A mapping from identifying key to config object. */
|
||||||
protected HashMap<String,ObjectRecord> _configs =
|
protected HashMap<String,ObjectRecord> _configs =
|
||||||
new HashMap<String,ObjectRecord>();
|
new HashMap<String,ObjectRecord>();
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,15 +41,15 @@ public class BasicStreamers
|
|||||||
Float.class,
|
Float.class,
|
||||||
Double.class,
|
Double.class,
|
||||||
String.class,
|
String.class,
|
||||||
(new boolean[0]).getClass(),
|
boolean[].class,
|
||||||
(new byte[0]).getClass(),
|
byte[].class,
|
||||||
(new short[0]).getClass(),
|
short[].class,
|
||||||
(new char[0]).getClass(),
|
char[].class,
|
||||||
(new int[0]).getClass(),
|
int[].class,
|
||||||
(new long[0]).getClass(),
|
long[].class,
|
||||||
(new float[0]).getClass(),
|
float[].class,
|
||||||
(new double[0]).getClass(),
|
double[].class,
|
||||||
(new Object[0]).getClass(),
|
Object[].class,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** An array of instances of all of the basic streamers. */
|
/** An array of instances of all of the basic streamers. */
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public abstract class FieldMarshaller
|
|||||||
// informatively if the user attempts to store non-Streamable
|
// informatively if the user attempts to store non-Streamable
|
||||||
// objects in that field
|
// objects in that field
|
||||||
_marshallers.put(Object.class, gmarsh);
|
_marshallers.put(Object.class, gmarsh);
|
||||||
_marshallers.put((new Object[0]).getClass(), gmarsh);
|
_marshallers.put(Object[].class, gmarsh);
|
||||||
|
|
||||||
// create marshallers for the primitive types
|
// create marshallers for the primitive types
|
||||||
_marshallers.put(Boolean.TYPE, new FieldMarshaller() {
|
_marshallers.put(Boolean.TYPE, new FieldMarshaller() {
|
||||||
|
|||||||
Reference in New Issue
Block a user