Sha256: 6c382c52826b2c4c5c9a939eb769090e81b0cfa4245de6d6e00e0ab2d3aaff35

Contents?: true

Size: 1.49 KB

Versions: 76

Compression:

Stored size: 1.49 KB

Contents

package org.embulk.spi.util.dynamic;

import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampFormatter;
import org.msgpack.value.Value;
import org.msgpack.value.ValueFactory;

public class JsonColumnSetter
        extends AbstractDynamicColumnSetter
{
    private final TimestampFormatter timestampFormatter;

    public JsonColumnSetter(PageBuilder pageBuilder, Column column,
                            DefaultValueSetter defaultValue,
                            TimestampFormatter timestampFormatter)
    {
        super(pageBuilder, column, defaultValue);
        this.timestampFormatter = timestampFormatter;
    }

    @Override
    public void setNull()
    {
        pageBuilder.setNull(column);
    }

    @Override
    public void set(boolean v)
    {
        pageBuilder.setJson(column, ValueFactory.newBoolean(v));
    }

    @Override
    public void set(long v)
    {
        pageBuilder.setJson(column, ValueFactory.newInteger(v));
    }

    @Override
    public void set(double v)
    {
        pageBuilder.setJson(column, ValueFactory.newFloat(v));
    }

    @Override
    public void set(String v)
    {
        pageBuilder.setJson(column, ValueFactory.newString(v));
    }

    @Override
    public void set(Timestamp v)
    {
        pageBuilder.setJson(column, ValueFactory.newString(timestampFormatter.format(v)));
    }

    @Override
    public void set(Value v)
    {
        pageBuilder.setJson(column, v);
    }
}

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
embulk-0.8.39 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.39-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.38 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.38-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.37 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.37-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.36 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.36-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.35 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.35-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.34 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.34-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.33 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.33-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.32 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.32-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.31 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.31-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.30 embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java
embulk-0.8.30-java embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java