push(new StringValueCommand(value));
break;
}
case ENUM_TYPE: {
// ETypeSeedName~IOrdinal~
EnumValueCommand x = new EnumValueCommand();
push(x);
// use ordinal (and not name), since name might have been obfuscated
int ordinal = readCommand(IntValueCommand.class).getValue();
@SuppressWarnings("unchecked")
Class<? extends Enum> clazz = findClass(token).asSubclass(Enum.class);
/*
* TODO: Note this approach could be prone to subtle corruption or
* an ArrayOutOfBoundsException if the client and server have drifted.
*/
Enum<?> enumConstants[] = clazz.getEnumConstants();
x.setValue(enumConstants[ordinal]);
break;
}
case ARRAY_TYPE: {
// Encoded as (leafType, dimensions, length, .... )
Class<?> leaf = findClass(token);
Integer numDims = readCommand(IntValueCommand.class).getValue();
Class<?> clazz;
if (numDims > 1) {
int[] dims = new int[numDims - 1];
clazz = Array.newInstance(leaf, dims).getClass();
} else {
clazz = leaf;
}
ArrayValueCommand x = new ArrayValueCommand(clazz);
push(x);
int length = readCommand(IntValueCommand.class).getValue();
for (int i = 0; i < length; i++) {
x.add(readCommand(ValueCommand.class));
}
break;
}
case OBJECT_TYPE: {
// @TypeSeedName~3~... N-many setters ...