protected final Object parseValue()

in java/ws-server/src/main/java/com/epam/deltix/tbwg/webapp/services/grafana/qql/SelectBuilder2.java [592:623]


            protected final Object parseValue(DataType dataType, String value) throws WrongTypeException {
                try {
                    if (value == null || value.equalsIgnoreCase(SpecialValue.MINUS_INF.name)
                            || value.equalsIgnoreCase(SpecialValue.PLUS_INF.name)
                            || value.equalsIgnoreCase(SpecialValue.NAN.name)
                            || value.equalsIgnoreCase(SpecialValue.NULL.name)) {
                        return null;
                    }
                    if (dataType instanceof DateTimeDataType) {
                        Object object;
                        try {
                            long longValue = Long.parseLong(value);
                            object = dateTimeLiteral(longValue);
                        } catch (NumberFormatException exc) {
                            Instant instantValue = Instant.parse(value);
                            object = dateTimeLiteral(instantValue);
                        }
                        return object;
                    } else if (dataType instanceof EnumDataType) {
                        EnumDataType enumDataType = (EnumDataType) dataType;
                        if (parseEnum(enumDataType, value)) {
                            return value;
                        } else if (value.equalsIgnoreCase("null")) {
                            return null;
                        }
                        throw new WrongTypeException(getFullName(), value, dataType);
                    }
                    return RawMessageHelper.parseValue(dataType, value);
                } catch (IllegalArgumentException exc) {
                    throw new WrongTypeException(getFullName(), value, dataType);
                }
            }