本文整理了Java中org.apache.tapestry5.json.JSONArray.get()
方法的一些代码示例,展示了JSONArray.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.get()
方法的具体详情如下:
包路径:org.apache.tapestry5.json.JSONArray
类名称:JSONArray
方法名:get
[英]Returns the value at index.
[中]返回索引处的值。
代码示例来源:origin: json-path/JsonPath
@Override
public Object getArrayIndex(final Object obj, final int idx) {
return ((JSONArray) obj).get(idx);
}
代码示例来源:origin: com.jayway.jsonpath/json-path
@Override
public Object getArrayIndex(final Object obj, final int idx) {
return ((JSONArray) obj).get(idx);
}
代码示例来源:origin: com.github.lafa.jsonpath/json-path
@Override
public Object getArrayIndex(final Object obj, final int idx) {
return ((JSONArray) obj).get(idx);
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is a {@code
* JSONObject}.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value doesn't exist or is not a {@code
* JSONObject}.
*/
public JSONObject getJSONObject(int index) {
Object object = get(index);
if (object instanceof JSONObject) {
return (JSONObject) object;
} else {
throw JSON.typeMismatch(true, index, object, "JSONObject");
}
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is a {@code
* JSONArray}.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value doesn't exist or is not a {@code
* JSONArray}.
*/
public JSONArray getJSONArray(int index) {
Object object = get(index);
if (object instanceof JSONArray) {
return (JSONArray) object;
} else {
throw JSON.typeMismatch(true, index, object, "JSONArray");
}
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is a {@code
* JSONObject}.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value doesn't exist or is not a {@code
* JSONObject}.
*/
public JSONObject getJSONObject(int index) {
Object object = get(index);
if (object instanceof JSONObject) {
return (JSONObject) object;
} else {
throw JSON.typeMismatch(true, index, object, "JSONObject");
}
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is a {@code
* JSONArray}.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value doesn't exist or is not a {@code
* JSONArray}.
*/
public JSONArray getJSONArray(int index) {
Object object = get(index);
if (object instanceof JSONArray) {
return (JSONArray) object;
} else {
throw JSON.typeMismatch(true, index, object, "JSONArray");
}
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists, coercing it if
* necessary.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if no such value exists.
*/
public String getString(int index) {
Object object = get(index);
String result = JSON.toString(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "String");
}
return result;
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists, coercing it if
* necessary.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if no such value exists.
*/
public String getString(int index) {
Object object = get(index);
String result = JSON.toString(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "String");
}
return result;
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is a long or
* can be coerced to a long.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a long.
*/
public long getLong(int index) {
Object object = get(index);
Long result = JSON.toLong(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "long");
}
return result;
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is a boolean or can
* be coerced to a boolean.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a boolean.
*/
public boolean getBoolean(int index) {
Object object = get(index);
Boolean result = JSON.toBoolean(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "Boolean");
}
return result;
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is a long or
* can be coerced to a long.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a long.
*/
public long getLong(int index) {
Object object = get(index);
Long result = JSON.toLong(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "long");
}
return result;
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is a double or can
* be coerced to a double.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a double.
*/
public double getDouble(int index) {
Object object = get(index);
Double result = JSON.toDouble(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "number");
}
return result;
}
代码示例来源:origin: apache/tapestry-5
/**
* Returns the value at {@code index} if it exists and is an int or
* can be coerced to an int.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a int.
*/
public int getInt(int index) {
Object object = get(index);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "int");
}
return result;
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is a boolean or can
* be coerced to a boolean.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a boolean.
*/
public boolean getBoolean(int index) {
Object object = get(index);
Boolean result = JSON.toBoolean(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "Boolean");
}
return result;
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is a double or can
* be coerced to a double.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a double.
*/
public double getDouble(int index) {
Object object = get(index);
Double result = JSON.toDouble(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "number");
}
return result;
}
代码示例来源:origin: org.apache.tapestry/tapestry-json
/**
* Returns the value at {@code index} if it exists and is an int or
* can be coerced to an int.
*
* @param index Which value to get.
* @return the value at the specified location.
* @throws RuntimeException if the value at {@code index} doesn't exist or
* cannot be coerced to a int.
*/
public int getInt(int index) {
Object object = get(index);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(true, index, object, "int");
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!