本文整理了Java中org.codehaus.jackson.JsonNode.isNumber()
方法的一些代码示例,展示了JsonNode.isNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.isNumber()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:isNumber
暂无
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
protected JsonNode currentNumericNode()
throws JsonParseException
{
JsonNode n = currentNode();
if (n == null || !n.isNumber()) {
JsonToken t = (n == null) ? null : n.asToken();
throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors");
}
return n;
}
代码示例来源:origin: azkaban/azkaban
} else if (node.isTextual()) {
return node.asText();
} else if (node.isNumber()) {
if (node.isInt()) {
return node.asInt();
代码示例来源:origin: org.apache.avro/avro
case FLOAT:
case DOUBLE:
return defaultValue.isNumber();
case BOOLEAN:
return defaultValue.isBoolean();
代码示例来源:origin: voldemort/voldemort
case FLOAT:
case DOUBLE:
if(!defaultJson.isNumber()) {
expectedVal = "number";
代码示例来源:origin: apache/nifi
if (fieldNode.isNumber()) {
return fieldNode.getNumberValue();
代码示例来源:origin: apache/nifi
if (fieldNode.isNumber()) {
return fieldNode.getNumberValue();
代码示例来源:origin: org.apache.avro/avro
break;
case INT:
if (!n.isNumber())
throw new AvroTypeException("Non-numeric default value for int: "+n);
e.writeInt(n.getIntValue());
break;
case LONG:
if (!n.isNumber())
throw new AvroTypeException("Non-numeric default value for long: "+n);
e.writeLong(n.getLongValue());
break;
case FLOAT:
if (!n.isNumber())
throw new AvroTypeException("Non-numeric default value for float: "+n);
e.writeFloat((float) n.getDoubleValue());
break;
case DOUBLE:
if (!n.isNumber())
throw new AvroTypeException("Non-numeric default value for double: "+n);
e.writeDouble(n.getDoubleValue());
代码示例来源:origin: camunda/camunda-bpm-platform
protected JsonNode currentNumericNode()
throws JsonParseException
{
JsonNode n = currentNode();
if (n == null || !n.isNumber()) {
JsonToken t = (n == null) ? null : n.asToken();
throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors");
}
return n;
}
代码示例来源:origin: apache/incubator-sentry
private Integer getIntegerField(final JsonNode pNode, final String pFieldName) {
Preconditions.checkNotNull(pNode);
Preconditions.checkNotNull(pFieldName);
return pNode.get(pFieldName) != null && pNode.get(pFieldName).isNumber() ? pNode.get(pFieldName)
.getIntValue() : null;
}
代码示例来源:origin: apache/sentry
private Integer getIntegerField(final JsonNode pNode, final String pFieldName) {
Preconditions.checkNotNull(pNode);
Preconditions.checkNotNull(pFieldName);
return pNode.get(pFieldName) != null && pNode.get(pFieldName).isNumber() ? pNode.get(pFieldName)
.getIntValue() : null;
}
代码示例来源:origin: CryptoWorldChain/ewallet
public static String getValueByType(JsonNode value){
if(value.isNumber()) return value.asText();
return "'"+value.asText()+"'";
}
public static String mapKey(String key,Map<String,String> fieldsMap){
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
private boolean isNumber(final JsonNode node) {
return !representsNull(node) && node.isValueNode() && node.isNumber();
}
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
private Byte getByte(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
checkValue(path, node, "an byte");
if (!node.isNumber()) {
// there is no node.isByte()
throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
return node.getNumberValue().byteValue();
}
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
private Float getFloat(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
checkValue(path, node, "a float");
if (!node.isNumber()) {
throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
return node.getNumberValue().floatValue();
}
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
private Short getShort(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
checkValue(path, node, "an short");
if (!node.isNumber()) {
// there is no node.isShort()
throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
return node.getNumberValue().shortValue();
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl
protected JsonNode currentNumericNode()
throws JsonParseException
{
JsonNode n = currentNode();
if (n == null || !n.isNumber()) {
JsonToken t = (n == null) ? null : n.asToken();
throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors");
}
return n;
}
代码示例来源:origin: com.atlassian.voorhees/atlassian-voorhees
private Object extractId(JsonNode idNode) {
if (idNode == null)
return null;
if (idNode.isNumber())
return idNode.getNumberValue();
if (idNode.isTextual())
return idNode.getTextValue();
if (idNode.isNull())
return null;
throw new IllegalArgumentException("Not a valid id type: " + idNode);
}
}
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
private Number getNumber(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
checkValue(path, node, "a number");
if (!node.isNumber()) {
throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
return node.getNumberValue();
}
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
protected JsonNode currentNumericNode()
throws JsonParseException
{
JsonNode n = currentNode();
if (n == null || !n.isNumber()) {
JsonToken t = (n == null) ? null : n.asToken();
throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors");
}
return n;
}
代码示例来源:origin: ovea-deprecated/jetty-session-redis
protected JsonNode currentNumericNode()
throws JsonParseException
{
JsonNode n = currentNode();
if (n == null || !n.isNumber()) {
JsonToken t = (n == null) ? null : n.asToken();
throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors");
}
return n;
}
内容来源于网络,如有侵权,请联系作者删除!