Sha256: 8d840b3da60dca59dfd4ade91dd8731c52027769b6a11ccc52fa31c435ef49b7
Contents?: true
Size: 1.3 KB
Versions: 113
Compression:
Stored size: 1.3 KB
Contents
package org.embulk.spi.unit; 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 public 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
113 entries across 113 versions & 1 rubygems