Java Code Examples for org.msgpack.value.ValueFactory#newString()

The following examples show how to use org.msgpack.value.ValueFactory#newString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitMap_DropColumns()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "drop_columns:",
            "  - {name: $.json1.k1.k1}",
            "  - {name: $.json1.k2}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":{"k1":"v"},"k2":{"k2":"v"}}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newMap(k1, v),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":{}}", visited.toString());
}
 
Example 2
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitMap_AddColumns()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "add_columns:",
            "  - {name: $.json1.k3.k3, type: string, default: v}",
            "  - {name: $.json1.k4, src: $.json1.k2}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":{"k1":"v"},"k2":{"k2":"v"}}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newMap(k1, v),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":{\"k1\":\"v\"},\"k2\":{\"k2\":\"v\"},\"k3\":{\"k3\":\"v\"},\"k4\":{\"k2\":\"v\"}}", visited.toString());
}
 
Example 3
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visit_withColumnNameIncludingSingleQuotes()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            " - {name: \"$['\\\\'json1']['k1']\"}");
    Schema inputSchema = Schema.builder()
            .add("'json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":"v"}
    Value k1 = ValueFactory.newString("k1");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(k1, v);

    MapValue visited = subject.visit("$['\\'json1']", map).asMapValue();
    assertEquals("{\"k1\":\"v\"}", visited.toString());
}
 
Example 4
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visit_withComplexRename()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            " - {name: \"$.json1['k____1']\", src: \"$.json1['k.-=+1']\"}",
            " - {name: \"$.json1['k____1'][0]['k____1']\", src: \"$.json1['k____1'][0]['k.-=+1']\"}",
            " - {name: \"$['json1']['k_2']\", src: \"$['json1']['k.2']\"}",
            " - {name: \"$['json1']['k_2']['k_2']\", src: \"$['json1']['k_2']['k.2']\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k.1":[{"k.1":"v"}], "k.2":{"k.2":"v"}}
    Value k1 = ValueFactory.newString("k.-=+1");
    Value k2 = ValueFactory.newString("k.2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k____1\":[{\"k____1\":\"v\"}],\"k_2\":{\"k_2\":\"v\"}}", visited.toString());
}
 
Example 5
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visit_withSingleQuotesAndDoubleQuotes()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            " - {name: \"$['json1']['k_1']\", src: \"$['json1']['k.1']\"}",
            " - {name: '$[\"json1\"][\"k_1\"][0][\"k_1\"]', src: '$[\"json1\"][\"k_1\"][0][\"k.1\"]'}",
            " - {name: '$[\"json1\"][\"k_2\"]', src: '$[\"json1\"][\"k.2\"]'}",
            " - {name: '$[\"json1\"][\"k_2\"][\"k_2\"]', src: '$[\"json1\"][\"k_2\"][\"k.2\"]'}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k.1":[{"k.1":"v"}], "k.2":{"k.2":"v"}}
    Value k1 = ValueFactory.newString("k.1");
    Value k2 = ValueFactory.newString("k.2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k_1\":[{\"k_1\":\"v\"}],\"k_2\":{\"k_2\":\"v\"}}", visited.toString());
}
 
Example 6
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitMap_dropColumnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "drop_columns:",
            "  - {name: \"$['json1']['k1']['k1']\"}",
            "  - {name: \"$['json1']['k2']\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":{"k1":"v"},"k2":{"k2":"v"}}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newMap(k1, v),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":{}}", visited.toString());
}
 
Example 7
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitMap_addColumnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "add_columns:",
            "  - {name: \"$['json1']['k3']['k3']\", type: string, default: v}",
            "  - {name: \"$['json1']['k4']\", src: \"$['json1']['k2']\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":{"k1":"v"},"k2":{"k2":"v"}}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newMap(k1, v),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":{\"k1\":\"v\"},\"k2\":{\"k2\":\"v\"},\"k3\":{\"k3\":\"v\"},\"k4\":{\"k2\":\"v\"}}", visited.toString());
}
 
Example 8
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitMap_columnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            "  - {name: \"$['json1']['k1']\"}",
            "  - {name: \"$['json1']['k2']['k2']\"}",
            "  - {name: \"$['json1']['k3']['k3']\", type: string, default: v}",
            "  - {name: \"$['json1']['k4']\", src: \"$['json1']['k2']\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":{"k1":"v"},"k2":{"k1":"v","k2":"v"}}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newMap(k1, v),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":{\"k1\":\"v\"},\"k2\":{\"k2\":\"v\"},\"k3\":{\"k3\":\"v\"},\"k4\":{\"k2\":\"v\"}}", visited.toString());
}
 
Example 9
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitArray_dropColumnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "drop_columns:",
            "  - {name: \"$['json1']['k1'][0]['k1']\"}",
            "  - {name: \"$['json1']['k2'][*]\"}"); // ending with [*] is allowed for drop_columns, but not for others
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"}[,"k2":["v","v"]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newArray(v, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{}],\"k2\":[]}", visited.toString());
}
 
Example 10
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitArray_addColumnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "add_columns:",
            "  - {name: \"$['json1']['k1'][1]\", src: \"$['json1']['k1'][0]\"}",
            "  - {name: \"$['json1']['k3'][0]['k3']\", type: string, default: v}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"}],"k2":["v","v"]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newArray(v, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{\"k1\":\"v\"},{\"k1\":\"v\"}],\"k2\":[\"v\",\"v\"],\"k3\":[{\"k3\":\"v\"}]}", visited.toString());
}
 
Example 11
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visitArray_columnsUsingBracketNotation()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            "  - {name: \"$['json1']['k1'][1]\", src: \"$['json1']['k1'][0]\"}",
            "  - {name: \"$['json1']['k2'][0]\"}",
            "  - {name: \"$['json1']['k3'][0]['k3']\", type: string, default: v}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"},"v"],"k2":["v","v"]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v), v),
            k2, ValueFactory.newArray(v, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{\"k1\":\"v\"}],\"k2\":[\"v\"],\"k3\":[{\"k3\":\"v\"}]}", visited.toString());
}
 
Example 12
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 6 votes vote down vote up
@Test
public void visit_withDotAndBracket()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            " - {name: \"$.json1['k_1']\"}",
            " - {name: \"$.json1['k_1'][0]['k_1']\"}",
            " - {name: \"$['json1']['k_2']\"}",
            " - {name: \"$['json1']['k_2']['k_2']\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k.1":[{"k.1":"v"}], "k.2":{"k.2":"v"}}
    Value k1 = ValueFactory.newString("k_1");
    Value k2 = ValueFactory.newString("k_2");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newMap(k2, v));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k_1\":[{\"k_1\":\"v\"}],\"k_2\":{\"k_2\":\"v\"}}", visited.toString());
}
 
Example 13
Source File: TestColumnCaster.java    From embulk-parser-jsonl with MIT License 5 votes vote down vote up
@Before
public void createResource()
{
    jruby = new ScriptingContainer();
    thrown = new DataException("any");
    Value[] kvs = new Value[2];
    kvs[0] = ValueFactory.newString("k");
    kvs[1] = ValueFactory.newString("v");
    mapValue = ValueFactory.newMap(kvs);
    parser = new TimestampParser(jruby, "%Y-%m-%d %H:%M:%S.%N", DateTimeZone.UTC);
}
 
Example 14
Source File: JsonVisitor.java    From embulk-filter-column with MIT License 5 votes vote down vote up
static Value getDefault(PluginTask task, String name, Type type, ColumnConfig columnConfig)
{
    Object defaultValue = ColumnVisitorImpl.getDefault(task, name, type, columnConfig);
    if (defaultValue == null) {
        return ValueFactory.newNil();
    }
    if (type instanceof BooleanType) {
        return ValueFactory.newBoolean((Boolean) defaultValue);
    }
    else if (type instanceof LongType) {
        return ValueFactory.newInteger((Long) defaultValue);
    }
    else if (type instanceof DoubleType) {
        return ValueFactory.newFloat((Double) defaultValue);
    }
    else if (type instanceof StringType) {
        return ValueFactory.newString((String) defaultValue.toString());
    }
    else if (type instanceof JsonType) {
        return (Value) defaultValue;
    }
    else if (type instanceof TimestampType) {
        throw new ConfigException("type: timestamp is not available in json path");
    }
    else {
        throw new ConfigException(String.format("type: '%s' is not supported", type));
    }
}
 
Example 15
Source File: TestJsonCast.java    From embulk-parser-jsonl with MIT License 5 votes vote down vote up
@Before
public void createResource()
{
    Value[] kvs = new Value[2];
    kvs[0] = ValueFactory.newString("k");
    kvs[1] = ValueFactory.newString("v");
    value = ValueFactory.newMap(kvs);
}
 
Example 16
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 5 votes vote down vote up
@Test
public void visitArray_Columns()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "columns:",
            "  - {name: \"$.json1.k1[1]\", src: \"$.json1.k1[0]\"}",
            "  - {name: \"$.json1.k2[0]\"}",
            "  - {name: \"$.json1.k3[*].k1\"}",
            "  - {name: \"$.json1.k3[*].k3\", src: \"$.json1.k3[*].k1\"}",
            "  - {name: \"$.json1.k4[*].k1\", type: string, default: v}",
            "  - {name: \"$.json1.k5[0].k1\", type: string, default: v}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"},"v"],"k2":["v","v"],"k3":[{"k1":"v","k2":"v"}]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value k3 = ValueFactory.newString("k3");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v), v),
            k2, ValueFactory.newArray(v, v),
            k3, ValueFactory.newArray(ValueFactory.newMap(k1, v, k2, v)));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{\"k1\":\"v\"}],\"k2\":[\"v\"],\"k3\":[{\"k1\":\"v\",\"k3\":\"v\"}],\"k4\":[],\"k5\":[{\"k1\":\"v\"}]}", visited.toString());
}
 
Example 17
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 5 votes vote down vote up
@Test
public void visitArray_AddColumns()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "add_columns:",
            "  - {name: \"$.json1.k1[1]\", src: \"$.json1.k1[0]\"}",
            "  - {name: \"$.json1.k3[*].k2\", type: string, default: v}",
            "  - {name: \"$.json1.k4[*].k1\", type: string, default: v}",
            "  - {name: \"$.json1.k5[0].k1\", type: string, default: v}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"}],"k2":["v","v"],"k3":[{"k1":"v"}]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value k3 = ValueFactory.newString("k3");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newArray(v, v),
            k3, ValueFactory.newArray(ValueFactory.newMap(k1, v)));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{\"k1\":\"v\"},{\"k1\":\"v\"}],\"k2\":[\"v\",\"v\"],\"k3\":[{\"k1\":\"v\",\"k2\":\"v\"}],\"k4\":[],\"k5\":[{\"k1\":\"v\"}]}", visited.toString());
}
 
Example 18
Source File: TestJsonVisitor.java    From embulk-filter-column with MIT License 5 votes vote down vote up
@Test
public void visitArray_DropColumns()
{
    PluginTask task = taskFromYamlString(
            "type: column",
            "drop_columns:",
            "  - {name: \"$.json1.k1[0].k1\"}",
            "  - {name: \"$.json1.k2[*]\"}", // ending with [*] is allowed for drop_columns, but not for others
            "  - {name: \"$.json1.k3[*].k1\"}");
    Schema inputSchema = Schema.builder()
            .add("json1", JSON)
            .add("json2", JSON)
            .build();
    JsonVisitor subject = jsonVisitor(task, inputSchema);

    // {"k1":[{"k1":"v"}],"k2":["v","v"],"k3":[{"k3":"v"}]}
    Value k1 = ValueFactory.newString("k1");
    Value k2 = ValueFactory.newString("k2");
    Value k3 = ValueFactory.newString("k3");
    Value v = ValueFactory.newString("v");
    Value map = ValueFactory.newMap(
            k1, ValueFactory.newArray(ValueFactory.newMap(k1, v)),
            k2, ValueFactory.newArray(v, v),
            k3, ValueFactory.newArray(ValueFactory.newMap(k1, v)));

    MapValue visited = subject.visit("$['json1']", map).asMapValue();
    assertEquals("{\"k1\":[{}],\"k2\":[],\"k3\":[{}]}", visited.toString());
}
 
Example 19
Source File: JsonColumn.java    From embulk-filter-column with MIT License 5 votes vote down vote up
public JsonColumn(String path, Type type, Value defaultValue, String src)
{
    Path compiledPath = PathCompiler.compile(path);
    Path compiledSrc = src == null ? compiledPath : PathCompiler.compile(src);
    RootPathToken compiledRoot = (RootPathToken) compiledPath.getRoot();
    RootPathToken compiledSrcRoot = (RootPathToken) compiledSrc.getRoot();
    this.path = compiledPath.toString();
    this.type = type;
    this.defaultValue = (defaultValue == null ? ValueFactory.newNil() : defaultValue);
    this.src = compiledSrc.toString();

    this.pathValue = ValueFactory.newString(path);
    this.parentPath = compiledPath.getParentPath();

    this.tailIndex = getTailIndex(compiledRoot);
    this.parentPathValue = ValueFactory.newString(parentPath);
    String tailName = getTailName(compiledRoot);
    this.tailNameValue = tailName == null ? ValueFactory.newNil() : ValueFactory.newString(tailName);

    this.srcValue = ValueFactory.newString(this.src);
    this.srcParentPath = compiledSrc.getParentPath();
    this.srcTailIndex = getTailIndex(compiledSrcRoot);
    this.srcParentPathValue = ValueFactory.newString(this.srcParentPath);
    String srcTailName = getTailName(compiledSrcRoot);
    this.srcTailNameValue = srcTailName == null ? ValueFactory.newNil() : ValueFactory.newString(srcTailName);

    if (!srcParentPath.equals(parentPath)) {
        throw new ConfigException(String.format("The branch (parent path) of src \"%s\" must be same with of name \"%s\" yet", src, path));
    }
}
 
Example 20
Source File: MessagePackSerializer.java    From attic-polygene-java with Apache License 2.0 4 votes vote down vote up
private Value doSerialize( Options options, Object object, boolean root )
{
    try
    {
        if( object == null )
        {
            return ValueFactory.newNil();
        }
        Class<?> objectClass = object.getClass();
        Converter<Object> converter = converters.converterFor( objectClass );
        if( converter != null )
        {
            return doSerialize( options, converter.toString( object ), false );
        }
        MessagePackAdapter<?> adapter = adapters.adapterFor( objectClass );
        if( adapter != null )
        {
            return adapter.serialize( object, obj -> doSerialize( options, obj, false ) );
        }
        if( EnumType.isEnum( objectClass ) )
        {
            return ValueFactory.newString( object.toString() );
        }
        if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
        {
            return serializeStatefulAssociationValue( options, object, root );
        }
        if( MapType.isMap( objectClass ) )
        {
            return serializeMap( options, (Map<?, ?>) object );
        }
        if( ArrayType.isArray( objectClass ) )
        {
            return serializeArray( options, object );
        }
        if( Iterable.class.isAssignableFrom( objectClass ) )
        {
            return serializeIterable( options, (Iterable<?>) object );
        }
        if( Stream.class.isAssignableFrom( objectClass ) )
        {
            return serializeStream( options, (Stream<?>) object );
        }
        throw new SerializationException( "Don't know how to serialize " + object );
    }
    catch( IOException ex )
    {
        throw new SerializationException( "Unable to serialize " + object, ex );
    }
}