本文整理汇总了Java中org.apache.kylin.common.util.JsonUtil.writeValueAsString方法的典型用法代码示例。如果您正苦于以下问题:Java JsonUtil.writeValueAsString方法的具体用法?Java JsonUtil.writeValueAsString怎么用?Java JsonUtil.writeValueAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.common.util.JsonUtil
的用法示例。
在下文中一共展示了JsonUtil.writeValueAsString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCuboids
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
public void setCuboids(Map<Long, Long> cuboids) {
if (cuboids == null)
return;
if (cuboids.isEmpty()) {
cuboidBytes = null;
return;
}
try {
String str = JsonUtil.writeValueAsString(cuboids);
byte[] compressed = CompressionUtils.compress(str.getBytes("UTF-8"));
cuboidBytes = compressed;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: setCuboidsRecommend
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
public void setCuboidsRecommend(Set<Long> cuboids) {
if (cuboids == null)
return;
if (cuboids.isEmpty()) {
cuboidBytesRecommend = null;
return;
}
try {
String str = JsonUtil.writeValueAsString(cuboids);
byte[] compressed = CompressionUtils.compress(str.getBytes("UTF-8"));
cuboidBytesRecommend = compressed;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例3: setConfiguration
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
public void setConfiguration(Map<String, String> configMap) {
if(configMap != null) {
String configStr = "";
try {
configStr = JsonUtil.writeValueAsString(configMap);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
setParam(HIVE_CONFIG, configStr);
}
}
示例4: serialize
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Override
public void serialize(QueryRecord record, DataOutputStream out) throws IOException {
String jsonStr = JsonUtil.writeValueAsString(record);
out.writeUTF(jsonStr);
}
示例5: testSerializeMap
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testSerializeMap() throws Exception {
Map<String, String> map = Maps.newHashMap();
map.put("key1", "value1");
map.put("key2", "value2");
String mapStr = JsonUtil.writeValueAsString(map);
System.out.println(mapStr);
Map<?, ?> map2 = JsonUtil.readValue(mapStr, HashMap.class);
Assert.assertEquals(map, map2);
}
示例6: testSerializeMap
import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testSerializeMap() throws Exception {
Map<String, String> map = Maps.newHashMap();
map.put("key1", "value1");
map.put("key2", "value2");
String mapStr = JsonUtil.writeValueAsString(map);
//System.out.println(mapStr);
Map<?, ?> map2 = JsonUtil.readValue(mapStr, HashMap.class);
Assert.assertEquals(map, map2);
}