use of io.spine.base.CommandContext.Schedule in project core-java by SpineEventEngine.
the class Commands method isScheduled.
/**
* Checks if the command is scheduled to be delivered later.
*
* @param command a command to check
* @return {@code true} if the command context has a scheduling option set,
* {@code false} otherwise
*/
public static boolean isScheduled(Command command) {
checkNotNull(command);
final Schedule schedule = command.getContext().getSchedule();
final Duration delay = schedule.getDelay();
if (isNotDefault(delay)) {
checkArgument(delay.getSeconds() > 0, "Command delay seconds must be a positive value.");
return true;
}
return false;
}