Search in sources :

Example 6 with TemporalParseException

use of org.neo4j.exceptions.TemporalParseException in project neo4j by neo4j.

the class TemporalValue method parse.

static <VALUE> VALUE parse(Class<VALUE> type, Pattern pattern, Function<Matcher, VALUE> parser, CharSequence text) {
    Matcher matcher = pattern.matcher(text);
    VALUE result = matcher.matches() ? parser.apply(matcher) : null;
    if (result == null) {
        throw new TemporalParseException("Text cannot be parsed to a " + valueName(type), text.toString(), 0);
    }
    return result;
}
Also used : Matcher(java.util.regex.Matcher) TemporalParseException(org.neo4j.exceptions.TemporalParseException)

Aggregations

TemporalParseException (org.neo4j.exceptions.TemporalParseException)6 Matcher (java.util.regex.Matcher)4 ZoneId (java.time.ZoneId)2 InvalidArgumentException (org.neo4j.exceptions.InvalidArgumentException)2 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 LocalTime (java.time.LocalTime)1 ZoneOffset (java.time.ZoneOffset)1 ZonedDateTime (java.time.ZonedDateTime)1 DateTimeParseException (java.time.format.DateTimeParseException)1 ZoneRulesException (java.time.zone.ZoneRulesException)1 UnsupportedTemporalUnitException (org.neo4j.exceptions.UnsupportedTemporalUnitException)1 AnyValue (org.neo4j.values.AnyValue)1