public RealRange parseRealRange(RangeAttributeDefinition attrDef, String value) { Map<String, Object> map = parseJSONToMap(value); if (map == null) { return null; } Double from = getDouble(map, RealRange.FROM_FIELD); Double to = getDouble(map, RealRange.TO_FIELD); if (to == null) { to = from; } Integer unitId = getInteger(map, RealRange.UNIT_ID_FIELD); Unit unit = attrDef.getActualUnit(unitId); return new RealRange(from, to, unit); }
public IntegerRange parseIntegerRange(RangeAttributeDefinition attrDef, String value) { Map<String, Object> map = parseJSONToMap(value); if (map == null) { return null; } Integer from = getInteger(map, IntegerRange.FROM_FIELD); Integer to = getInteger(map, IntegerRange.TO_FIELD); if (to == null) { to = from; } Integer unitId = getInteger(map, NumberValue.UNIT_ID_FIELD); Unit unit = attrDef.getActualUnit(unitId); return new IntegerRange(from, to, unit); }