com.clickzetta.client.jdbc.arrow.util.CZJsonStringHashMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.client.jdbc.arrow.util;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Simple class that extends the regular java.util.HashMap but overrides the
* toString() method of the HashMap class to produce a JSON string instead
*
* @param The type of the key for the map.
* @param The type of the value for the map.
*/
public class CZJsonStringHashMap extends LinkedHashMap {
@Override
public final String toString() {
List entries = new ArrayList<>(entrySet().size());
for (Map.Entry entry : entrySet()) {
entries.add(String.join(":",
JsonUtils.convert(entry.getKey()), JsonUtils.convert(entry.getValue())));
}
return "{" + String.join(",", entries) + "}";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy