本文整理汇总了Java中com.fasterxml.jackson.core.JsonParser.NumberType.FLOAT属性的典型用法代码示例。如果您正苦于以下问题:Java NumberType.FLOAT属性的具体用法?Java NumberType.FLOAT怎么用?Java NumberType.FLOAT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.fasterxml.jackson.core.JsonParser.NumberType
的用法示例。
在下文中一共展示了NumberType.FLOAT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doLe
protected boolean doLe(JsonNode propertyNode, JsonNode passedNode){
if(propertyNode.isNumber() && passedNode.isNumber() && propertyNode.numberType() == passedNode.numberType()) {
Number propertyValue = propertyNode.numberValue();
Number passedValue = passedNode.numberValue();
if(propertyNode.numberType() == NumberType.INT) {
return ((Integer) propertyValue <= (Integer) passedValue);
} else if(propertyNode.numberType() == NumberType.LONG) {
return ((Long) propertyValue <= (Long) passedValue);
} else if(propertyNode.numberType() == NumberType.FLOAT) {
return ((Float) propertyValue <= (Float) passedValue);
} else if(propertyNode.numberType() == NumberType.DOUBLE) {
return ((Double) propertyValue <= (Double) passedValue);
} else {
throw new UnsupportedExprException("Le supports only INT, LONG, DOUBLE, FLOAT values");
}
} else {
throw new UnsupportedExprException("Le supports only numeric values of same type for comparison");
}
}
示例2: doGt
protected boolean doGt(JsonNode propertyNode, JsonNode passedNode){
if(propertyNode.isNumber() && passedNode.isNumber() && propertyNode.numberType() == passedNode.numberType()) {
Number propertyValue = propertyNode.numberValue();
Number passedValue = passedNode.numberValue();
if(propertyNode.numberType() == NumberType.INT) {
return ((Integer) propertyValue > (Integer) passedValue);
} else if(propertyNode.numberType() == NumberType.LONG) {
return ((Long) propertyValue > (Long) passedValue);
} else if(propertyNode.numberType() == NumberType.FLOAT) {
return ((Float) propertyValue > (Float) passedValue);
} else if(propertyNode.numberType() == NumberType.DOUBLE) {
return ((Double) propertyValue > (Double) passedValue);
} else {
throw new UnsupportedExprException("Gt supports only INT, LONG, DOUBLE, FLOAT values");
}
} else {
throw new UnsupportedExprException("Gt supports only numeric values of same type for comparison");
}
}
示例3: doLt
protected boolean doLt(JsonNode propertyNode, JsonNode passedNode){
if(propertyNode.isNumber() && passedNode.isNumber() && propertyNode.numberType() == passedNode.numberType()) {
Number propertyValue = propertyNode.numberValue();
Number passedValue = passedNode.numberValue();
if(propertyNode.numberType() == NumberType.INT) {
return ((Integer) propertyValue < (Integer) passedValue);
} else if(propertyNode.numberType() == NumberType.LONG) {
return ((Long) propertyValue < (Long) passedValue);
} else if(propertyNode.numberType() == NumberType.FLOAT) {
return ((Float) propertyValue < (Float) passedValue);
} else if(propertyNode.numberType() == NumberType.DOUBLE) {
return ((Double) propertyValue < (Double) passedValue);
} else {
throw new UnsupportedExprException("Lt supports only INT, LONG, DOUBLE, FLOAT values");
}
} else {
throw new UnsupportedExprException("Lt supports only numeric values of same type for comparison");
}
}
示例4: doGe
private boolean doGe(JsonNode propertyNode, JsonNode passedNode){
if(propertyNode.isNumber() && passedNode.isNumber() && propertyNode.numberType() == passedNode.numberType()) {
Number propertyValue = propertyNode.numberValue();
Number passedValue = passedNode.numberValue();
if(propertyNode.numberType() == NumberType.INT) {
return ((Integer) propertyValue >= (Integer) passedValue);
} else if(propertyNode.numberType() == NumberType.LONG) {
return ((Long) propertyValue >= (Long) passedValue);
} else if(propertyNode.numberType() == NumberType.FLOAT) {
return ((Float) propertyValue >= (Float) passedValue);
} else if(propertyNode.numberType() == NumberType.DOUBLE) {
return ((Double) propertyValue >=(Double) passedValue);
} else {
throw new UnsupportedExprException("Ge supports only INT, LONG, DOUBLE, FLOAT values");
}
} else {
throw new UnsupportedExprException("Ge supports only numeric values of same type for comparison");
}
}
示例5: parseArray
private cfData parseArray(JsonParser jp, cfArrayData array, boolean bStrictMapping ) throws JsonParseException, IOException, cfmRunTimeException{
JsonToken token = jp.nextToken();
while ( token != JsonToken.END_ARRAY ){
if ( token == JsonToken.START_ARRAY ){
array.addElement( parseArray(jp,cfArrayData.createArray(1),bStrictMapping ) );
}else if ( token == JsonToken.START_OBJECT ){
array.addElement( parseObject(jp,new cfStructData(),bStrictMapping) );
}else if ( token == JsonToken.VALUE_NUMBER_INT ){
if ( jp.getNumberType() == NumberType.INT )
array.addElement( new cfNumberData(jp.getIntValue()) );
else if ( jp.getNumberType() == NumberType.LONG || jp.getNumberType() == NumberType.BIG_INTEGER )
array.addElement( new cfNumberData(jp.getLongValue()) );
}else if ( token == JsonToken.VALUE_NUMBER_FLOAT ){
if ( jp.getNumberType() == NumberType.FLOAT )
array.addElement( new cfNumberData(jp.getFloatValue()) );
else if ( jp.getNumberType() == NumberType.DOUBLE )
array.addElement( new cfNumberData(jp.getDoubleValue()) );
} else if ( token == JsonToken.VALUE_FALSE ){
array.addElement( cfBooleanData.FALSE );
} else if ( token == JsonToken.VALUE_TRUE ){
array.addElement( cfBooleanData.TRUE );
} else if ( token == JsonToken.VALUE_NULL ){
array.addElement( cfNullData.NULL );
}else
array.addElement( getString(jp.getText()) );
token = jp.nextToken();
}
return array;
}
示例6: getValue
private Serializable getValue (JsonParser parser, JsonToken token) throws IOException {
if (token != null) {
switch (token) {
case VALUE_STRING:
return parser.getText ();
case VALUE_NUMBER_INT:
if (parser.getNumberType () == NumberType.INT || parser.getNumberType () == NumberType.LONG) {
return Long.valueOf (parser.getLongValue ());
} else {
return parser.getNumberValue ();
}
case VALUE_NUMBER_FLOAT:
if (parser.getNumberType () == NumberType.FLOAT) {
return Float.valueOf (parser.getFloatValue ());
} else if (parser.getNumberType () == NumberType.DOUBLE) {
return Double.valueOf (parser.getDoubleValue ());
} else {
return parser.getNumberValue ();
}
case VALUE_TRUE:
return Boolean.TRUE;
case VALUE_FALSE:
return Boolean.FALSE;
case VALUE_NULL:
return null;
case END_ARRAY:
default:
break;
}
}
return null;
}