本文整理汇总了Java中org.boon.json.JsonFactory.toJson方法的典型用法代码示例。如果您正苦于以下问题:Java JsonFactory.toJson方法的具体用法?Java JsonFactory.toJson怎么用?Java JsonFactory.toJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.boon.json.JsonFactory
的用法示例。
在下文中一共展示了JsonFactory.toJson方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CBArray
import org.boon.json.JsonFactory; //导入方法依赖的package包/类
CBArray(List arrayList)
{
if (arrayList == null )
{
array=null;
jsonArray=null;
}
else
{
array = arrayList.toArray();
jsonArray = JsonFactory.toJson(array);
}
}
示例2: getStringChecked
import org.boon.json.JsonFactory; //导入方法依赖的package包/类
private String getStringChecked(String columnLabel) throws SQLException
{
Map <String,Object>jsonObject = response.getResults().get(index);
if (checkColumnLabelMissing(jsonObject, columnLabel))
{
return null;
}
Object object = jsonObject.get(columnLabel);
if (wasNull = (object == null))
{
return null;
}
if (object instanceof Map)
{
return JsonFactory.toJson(object);
}
else
{
if (!(object instanceof String))
{
return object.toString();
}
else
return (String)object;
}
}
示例3: toJson
import org.boon.json.JsonFactory; //导入方法依赖的package包/类
private synchronized void toJson()
{
if (sqlJson == null )
{
sqlJson = JsonFactory.toJson(jsonObject);
}
}
示例4: toString
import org.boon.json.JsonFactory; //导入方法依赖的package包/类
public String toString()
{
return JsonFactory.toJson(credentials);
}
示例5: doQuery
import org.boon.json.JsonFactory; //导入方法依赖的package包/类
public CouchResponse doQuery(String query, Map queryParameters) throws SQLException
{
Instance endPoint = getNextEndpoint();
// keep trying endpoints
while(true)
{
try {
String url = endPoint.getEndpointURL(ssl);
logger.trace("Using endpoint {}", url);
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Accept", "application/json");
logger.trace("do query {}", httpPost.toString());
addOptions(queryParameters);
String jsonParameters = JsonFactory.toJson(queryParameters);
StringEntity entity = new StringEntity(jsonParameters, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
CloseableHttpResponse response = httpClient.execute(httpPost);
return handleResponse(query, response);
}
catch (ConnectTimeoutException cte)
{
logger.trace(cte.getLocalizedMessage());
// this one failed, lets move on
invalidateEndpoint(endPoint);
// get the next one
endPoint = getNextEndpoint();
if (endPoint == null) {
throw new SQLException("All endpoints have failed, giving up");
}
} catch (Exception ex) {
logger.error("Error executing query [{}] {}", query, ex.getMessage());
throw new SQLException("Error executing update", ex);
}
}
}