Java Code Examples for com.alibaba.fastjson.util.TypeUtils#longExtractValue()
The following examples show how to use
com.alibaba.fastjson.util.TypeUtils#longExtractValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSONPath.java From uavstack with Apache License 2.0 | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); for (long value : values) { if (value == longPropertyValue) { return !not; } } } return not; }
Example 2
Source File: JSONPath.java From uavstack with Apache License 2.0 | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); if (longPropertyValue >= startValue && longPropertyValue <= endValue) { return !not; } } return not; }
Example 3
Source File: JSONPath_s.java From coming with MIT License | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); for (long value : values) { if (value == longPropertyValue) { return !not; } } } return not; }
Example 4
Source File: JSONPath_s.java From coming with MIT License | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); if (longPropertyValue >= startValue && longPropertyValue <= endValue) { return !not; } } return not; }
Example 5
Source File: JSONPath_t.java From coming with MIT License | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); for (long value : values) { if (value == longPropertyValue) { return !not; } } } return not; }
Example 6
Source File: JSONPath_t.java From coming with MIT License | 6 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (propertyValue instanceof Number) { long longPropertyValue = TypeUtils.longExtractValue((Number) propertyValue); if (longPropertyValue >= startValue && longPropertyValue <= endValue) { return !not; } } return not; }
Example 7
Source File: JSONPath_s.java From coming with MIT License | 4 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (!(propertyValue instanceof Number)) { return false; } Object refValue = refSgement.eval(path, rootObject, rootObject); if (refValue instanceof Integer || refValue instanceof Long || refValue instanceof Short || refValue instanceof Byte) { long value = TypeUtils.longExtractValue((Number) refValue); if (propertyValue instanceof Integer || propertyValue instanceof Long || propertyValue instanceof Short || propertyValue instanceof Byte) { long longValue = TypeUtils.longExtractValue((Number) propertyValue); switch (op) { case EQ: return longValue == value; case NE: return longValue != value; case GE: return longValue >= value; case GT: return longValue > value; case LE: return longValue <= value; case LT: return longValue < value; } } else if (propertyValue instanceof BigDecimal) { BigDecimal valueDecimal = BigDecimal.valueOf(value); int result = valueDecimal.compareTo((BigDecimal) propertyValue); switch (op) { case EQ: return result == 0; case NE: return result != 0; case GE: return 0 >= result; case GT: return 0 > result; case LE: return 0 <= result; case LT: return 0 < result; } return false; } } throw new UnsupportedOperationException(); }
Example 8
Source File: JSONPath_t.java From coming with MIT License | 4 votes |
public boolean apply(JSONPath path, Object rootObject, Object currentObject, Object item) { Object propertyValue = path.getPropertyValue(item, propertyName, propertyNameHash); if (propertyValue == null) { return false; } if (!(propertyValue instanceof Number)) { return false; } Object refValue = refSgement.eval(path, rootObject, rootObject); if (refValue instanceof Integer || refValue instanceof Long || refValue instanceof Short || refValue instanceof Byte) { long value = TypeUtils.longExtractValue((Number) refValue); if (propertyValue instanceof Integer || propertyValue instanceof Long || propertyValue instanceof Short || propertyValue instanceof Byte) { long longValue = TypeUtils.longExtractValue((Number) propertyValue); switch (op) { case EQ: return longValue == value; case NE: return longValue != value; case GE: return longValue >= value; case GT: return longValue > value; case LE: return longValue <= value; case LT: return longValue < value; } } else if (propertyValue instanceof BigDecimal) { BigDecimal valueDecimal = BigDecimal.valueOf(value); int result = valueDecimal.compareTo((BigDecimal) propertyValue); switch (op) { case EQ: return result == 0; case NE: return result != 0; case GE: return 0 >= result; case GT: return 0 > result; case LE: return 0 <= result; case LT: return 0 < result; } return false; } } throw new UnsupportedOperationException(); }