static void writeObjectTo(Output output, Object value,
            Schema<?> currentSchema, IdStrategy strategy) throws IOException
    {
        final Class<?> clazz = value.getClass();
        int dimensions = 1;
        Class<?> componentType = clazz.getComponentType();
        while (componentType.isArray())
        {
            dimensions++;
            componentType = componentType.getComponentType();
        }

        strategy.writeArrayIdTo(output, componentType);
        // write the length of the array
        output.writeUInt32(ID_ARRAY_LEN, ((Object[])value).length, false);
        // write the dimensions of the array
        output.writeUInt32(ID_ARRAY_DIMENSION, dimensions, false);

        if (output instanceof StatefulOutput)
        {
            // update using the derived schema.
            ((StatefulOutput) output).updateLast(strategy.ARRAY_SCHEMA,
                    currentSchema);
        }

        strategy.ARRAY_SCHEMA.writeTo(output, value);
    }
Used when a field is an array (Object[] or any polymorphic component type).

@author David Yu
@created Apr 25, 2012
protostuff-runtime/src/main/java/io/protostuff/runtime/ArraySchema.java