All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lifeonwalden.springscheduling.cronBuilder.model.Between Maven / Gradle / Ivy

There is a newer version: 0.2.11
Show newest version
package com.lifeonwalden.springscheduling.cronBuilder.model;

import com.lifeonwalden.springscheduling.cronBuilder.time.CronTime;

/**
 * 区间范围
 * 
 * @author luhong
 *
 */
public class Between implements FieldDefinition {
  private CronTime start;
  private CronTime end;

  public Between(CronTime start, CronTime end) {
    if (start.toCronTime() >= end.toCronTime()) {
      throw new RuntimeException("Invalid range.");
    }

    this.start = start;
    this.end = end;
  }

  @Override
  public String toExpression() {
    return Integer.toString(start.toCronTime()) + "-" + Integer.toString(end.toCronTime());
  }

  @Override
  public boolean isValid(Class clazz) {
    return clazz.isInstance(start) && clazz.isInstance(end);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy