Sha256: d85e25df12b7f887a73b7c7a12bd4a4c543ae4f53b71934f8a5359ff33fa3975

Contents?: true

Size: 1.29 KB

Versions: 23

Compression:

Stored size: 1.29 KB

Contents

package org.embulk.input.jdbc;

import com.google.common.base.Optional;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public class ToString
{
    private final String string;

    public ToString(String string)
    {
        this.string = string;
    }

    @JsonCreator
    ToString(Optional<JsonNode> option) throws JsonMappingException
    {
        JsonNode node = option.or(NullNode.getInstance());
        if (node.isTextual()) {
            this.string = node.textValue();
        } else if (node.isValueNode()) {
            this.string = node.toString();
        } else {
            throw new JsonMappingException(String.format("Arrays and objects are invalid: '%s'", node));
        }
    }

    @Override
    public boolean equals(Object obj)
    {
        if (!(obj instanceof ToString)) {
            return false;
        }
        ToString o = (ToString) obj;
        return string.equals(o.string);
    }

    @Override
    public int hashCode()
    {
        return string.hashCode();
    }

    @JsonValue
    @Override
    public String toString()
    {
        return string;
    }
}

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
embulk-input-jdbc-0.10.0 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.9.3 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.9.2 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-athena-0.1.0 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.9.1 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.9.0 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.6 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.5 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.4 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.3 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.2 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.1 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.8.0 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.7.4 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.7.3 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.7.2 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.7.1 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.7.0 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.6.4 src/main/java/org/embulk/input/jdbc/ToString.java
embulk-input-jdbc-0.6.3 src/main/java/org/embulk/input/jdbc/ToString.java