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