本文整理汇总了Java中com.alibaba.druid.support.json.JSONUtils类的典型用法代码示例。如果您正苦于以下问题:Java JSONUtils类的具体用法?Java JSONUtils怎么用?Java JSONUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JSONUtils类属于com.alibaba.druid.support.json包,在下文中一共展示了JSONUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doAfterThrowing
import com.alibaba.druid.support.json.JSONUtils; //导入依赖的package包/类
/**
* @param joinPoint
* @param e
*/
@AfterThrowing(value = "doAfterThrowing()", throwing = "e")
public void doAfterThrowing(JoinPoint joinPoint, Throwable e) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
Map<String, Object> map = new HashMap<String, Object>();
map.put("className", joinPoint.getTarget().getClass().getName());
map.put("methodName", method.getName());
map.put("args", JSONUtils.toJSONString(joinPoint.getArgs().toString()));
map.put("errorMsg", e.getMessage());
logger.error(JSONUtils.toJSONString(map));
}
示例2: jdbcSet
import com.alibaba.druid.support.json.JSONUtils; //导入依赖的package包/类
@Override
public Object jdbcSet(PreparedStatement st, Object value, int index, DatabaseDialect dialect) throws SQLException {
if (value == null) {
st.setNull(index, Types.STRUCT);
return null;
} else {
PGobject jsonObject = new PGobject();
jsonObject.setType("jsonb");
jsonObject.setValue(JSONUtils.toJSONString(value));
st.setObject(index, jsonObject);
return jsonObject;
}
}
示例3: jdbcSet
import com.alibaba.druid.support.json.JSONUtils; //导入依赖的package包/类
@Override
public Object jdbcSet(PreparedStatement st, Object value, int index, DatabaseDialect dialect) throws SQLException {
if (value == null) {
st.setNull(index, Types.STRUCT);
return null;
} else {
PGobject jsonObject = new PGobject();
jsonObject.setType("json");
jsonObject.setValue(JSONUtils.toJSONString(value));
st.setObject(index, jsonObject);
return jsonObject;
}
}
示例4: getSqlExpression
import com.alibaba.druid.support.json.JSONUtils; //导入依赖的package包/类
@Override
protected String getSqlExpression(Object value, DatabaseDialect profile) {
String json=JSONUtils.toJSONString(value);
return this.wrapSqlStr(json);
}