org.embulk.input.tsurugidb.common.ToStringMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of embulk-input-tsurugidb Show documentation
Show all versions of embulk-input-tsurugidb Show documentation
Selects records from a table.
The newest version!
package org.embulk.input.tsurugidb.common;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import com.fasterxml.jackson.annotation.JsonCreator;
// https://github.com/embulk/embulk-input-jdbc/blob/master/embulk-input-jdbc/src/main/java/org/embulk/input/jdbc/ToStringMap.java
@SuppressWarnings("serial")
public class ToStringMap extends HashMap {
@JsonCreator
ToStringMap(Map map) {
super(mapToStringString(map));
}
public Properties toProperties() {
Properties props = new Properties();
props.putAll(this);
return props;
}
private static Map mapToStringString(final Map mapOfToString) {
final HashMap result = new HashMap<>();
for (final Map.Entry entry : mapOfToString.entrySet()) {
final ToString value = entry.getValue();
if (value == null) {
result.put(entry.getKey(), "null");
} else {
result.put(entry.getKey(), value.toString());
}
}
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy