@Override
public void write(Packer packer, Object v, boolean required)
throws IOException {
if (v == null) {
if (required) {
throw new MessageTypeException("Attempted to write null");
}
packer.writeNil();
return;
}
if (!(v instanceof Object[]) || !componentClass.isAssignableFrom(v.getClass().getComponentType())) {
throw new MessageTypeException();
}
Object[] array = (Object[]) v;
int length = array.length;
packer.writeArrayBegin(length);