本文整理了Java中org.codehaus.jettison.json.JSONArray.remove()
方法的一些代码示例,展示了JSONArray.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.remove()
方法的具体详情如下:
包路径:org.codehaus.jettison.json.JSONArray
类名称:JSONArray
方法名:remove
暂无
代码示例来源:origin: json-path/JsonPath
@Override
public void removeProperty(Object obj, Object key)
{
try
{
if( obj instanceof org.codehaus.jettison.json.JSONArray )
{
int index = key instanceof Integer? (Integer) key : Integer.parseInt(key.toString());
if( index<length(obj) )
{
Object temp = new Object(); // Need FIX: JSONArray.remove(int)
((org.codehaus.jettison.json.JSONArray)obj).put(index, temp);
((org.codehaus.jettison.json.JSONArray)obj).remove(temp);
}
}
if( obj instanceof org.codehaus.jettison.json.JSONObject )
{
((org.codehaus.jettison.json.JSONObject)obj).remove(String.valueOf(key));
}
}
catch( org.codehaus.jettison.json.JSONException jsonException )
{
throw new IllegalStateException(jsonException);
}
}
代码示例来源:origin: com.jayway.jsonpath/json-path
@Override
public void removeProperty(Object obj, Object key)
{
try
{
if( obj instanceof org.codehaus.jettison.json.JSONArray )
{
int index = key instanceof Integer? (Integer) key : Integer.parseInt(key.toString());
if( index<length(obj) )
{
Object temp = new Object(); // Need FIX: JSONArray.remove(int)
((org.codehaus.jettison.json.JSONArray)obj).put(index, temp);
((org.codehaus.jettison.json.JSONArray)obj).remove(temp);
}
}
if( obj instanceof org.codehaus.jettison.json.JSONObject )
{
((org.codehaus.jettison.json.JSONObject)obj).remove(String.valueOf(key));
}
}
catch( org.codehaus.jettison.json.JSONException jsonException )
{
throw new IllegalStateException(jsonException);
}
}
代码示例来源:origin: cascading/cascading-hadoop2-tez-stats
protected JSONObject getRemoveJsonObject( JSONArray entitiesNode, int index, boolean doRemove )
{
try
{
JSONObject jsonObject = entitiesNode.getJSONObject( index );
if( doRemove )
entitiesNode.remove( jsonObject );
return jsonObject;
}
catch( JSONException exception )
{
throw new CascadingException( exception );
}
}
代码示例来源:origin: cwensel/cascading
protected JSONObject getRemoveJsonObject( JSONArray entitiesNode, int index, boolean doRemove )
{
try
{
JSONObject jsonObject = entitiesNode.getJSONObject( index );
if( doRemove )
entitiesNode.remove( jsonObject );
return jsonObject;
}
catch( JSONException exception )
{
throw new CascadingException( exception );
}
}
代码示例来源:origin: com.github.lafa.jsonpath/json-path
@Override
public void removeProperty(Object obj, Object key)
{
try
{
if( obj instanceof org.codehaus.jettison.json.JSONArray )
{
int index = key instanceof Integer? (Integer) key : Integer.parseInt(key.toString());
if( index<length(obj) )
{
Object temp = new Object(); // Need FIX: JSONArray.remove(int)
((org.codehaus.jettison.json.JSONArray)obj).put(index, temp);
((org.codehaus.jettison.json.JSONArray)obj).remove(temp);
}
}
if( obj instanceof org.codehaus.jettison.json.JSONObject )
{
((org.codehaus.jettison.json.JSONObject)obj).remove(String.valueOf(key));
}
}
catch( org.codehaus.jettison.json.JSONException jsonException )
{
throw new IllegalStateException(jsonException);
}
}
内容来源于网络,如有侵权,请联系作者删除!