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

com.lifeonwalden.springscheduling.cronBuilder.model.In 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 In implements FieldDefinition {
  private CronTime[] times;

  public In(CronTime... times) {
    this.times = times;
  }

  @Override
  public String toExpression() {
    StringBuilder sb = new StringBuilder();
    sb.append(times[0].toCronTime());
    for (int i = 1; i < times.length; i++) {
      sb.append(",").append(times[i].toCronTime());
    }

    return sb.toString();
  }

  @Override
  public boolean isValid(Class clazz) {
    for (CronTime time : times) {
      if (!clazz.isInstance(time)) {
        return false;
      }
    }

    return true;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy