use of org.neo4j.values.storable.TemporalValue in project neo4j by neo4j.
the class TemporalFunction method apply.
@Override
public final AnyValue apply(Context ctx, AnyValue[] input) throws ProcedureException {
if (input == null || (input.length > 0 && (input[0] == NO_VALUE || input[0] == null))) {
return NO_VALUE;
} else if (input.length == 0 || input[0].equals(DEFAULT_TEMPORAL_ARGUMENT_VALUE)) {
return now(ctx.statementClock(), null, defaultZone);
} else if (input[0] instanceof TextValue) {
return parse((TextValue) input[0], defaultZone);
} else if (input[0] instanceof TemporalValue) {
return select(input[0], defaultZone);
} else if (input[0] instanceof MapValue) {
MapValue map = (MapValue) input[0];
String timezone = onlyTimezone(map);
if (timezone != null) {
return now(ctx.statementClock(), timezone, defaultZone);
}
return build(map, defaultZone);
} else {
throw new ProcedureException(Status.Procedure.ProcedureCallFailed, "Invalid call signature for " + getClass().getSimpleName() + ": Provided input was " + Arrays.toString(input));
}
}
Aggregations