Search in sources :

Example 1 with Time

use of io.spine.option.Time in project core-java by SpineEventEngine.

the class MessageFieldValidator method validateTimestamps.

private void validateTimestamps() {
    final Time when = timeOption.getIn();
    if (when == TIME_UNDEFINED) {
        return;
    }
    final Timestamp now = getCurrentTime();
    for (Message value : getValues()) {
        final Timestamp time = (Timestamp) value;
        if (isTimeInvalid(time, when, now)) {
            addViolation(newTimeViolation(time));
            // return because one error message is enough for the "time" option
            return;
        }
    }
}
Also used : Message(com.google.protobuf.Message) Time(io.spine.option.Time) Time.getCurrentTime(io.spine.time.Time.getCurrentTime) Timestamp(com.google.protobuf.Timestamp)

Aggregations

Message (com.google.protobuf.Message)1 Timestamp (com.google.protobuf.Timestamp)1 Time (io.spine.option.Time)1 Time.getCurrentTime (io.spine.time.Time.getCurrentTime)1