annotations.io.alauda.kubernetes.api.model.PipelineTriggeScheduleFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class PipelineTriggeScheduleFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineTriggeScheduleFluent{
private List times = new ArrayList();
private List weeks = new ArrayList();
public PipelineTriggeScheduleFluentImpl(){
}
public PipelineTriggeScheduleFluentImpl(PipelineTriggeSchedule instance){
this.withTimes(instance.getTimes());
this.withWeeks(instance.getWeeks());
}
public A addToTimes(int index,String item){
this.times.add(index, item); return (A)this;
}
public A setToTimes(int index,String item){
this.times.set(index, item); return (A)this;
}
public A addToTimes(String... items){
for (String item : items) {this.times.add(item);} return (A)this;
}
public A addAllToTimes(Collection items){
for (String item : items) {this.times.add(item);} return (A)this;
}
public A removeFromTimes(String... items){
for (String item : items) {this.times.remove(item);} return (A)this;
}
public A removeAllFromTimes(Collection items){
for (String item : items) {this.times.remove(item);} return (A)this;
}
public List getTimes(){
return this.times;
}
public String getTime(int index){
return this.times.get(index);
}
public String getFirstTime(){
return this.times.get(0);
}
public String getLastTime(){
return this.times.get(times.size() - 1);
}
public String getMatchingTime(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: times) { if(predicate.apply(item)){return item;} } return null;
}
public A withTimes(List times){
this.times.clear();
if (times != null) {for (String item : times){this.addToTimes(item);}} return (A) this;
}
public A withTimes(String... times){
this.times.clear(); if (times != null) {for (String item :times){ this.addToTimes(item);}} return (A) this;
}
public Boolean hasTimes(){
return times!= null && !times.isEmpty();
}
public A addToWeeks(int index,String item){
this.weeks.add(index, item); return (A)this;
}
public A setToWeeks(int index,String item){
this.weeks.set(index, item); return (A)this;
}
public A addToWeeks(String... items){
for (String item : items) {this.weeks.add(item);} return (A)this;
}
public A addAllToWeeks(Collection items){
for (String item : items) {this.weeks.add(item);} return (A)this;
}
public A removeFromWeeks(String... items){
for (String item : items) {this.weeks.remove(item);} return (A)this;
}
public A removeAllFromWeeks(Collection items){
for (String item : items) {this.weeks.remove(item);} return (A)this;
}
public List getWeeks(){
return this.weeks;
}
public String getWeek(int index){
return this.weeks.get(index);
}
public String getFirstWeek(){
return this.weeks.get(0);
}
public String getLastWeek(){
return this.weeks.get(weeks.size() - 1);
}
public String getMatchingWeek(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: weeks) { if(predicate.apply(item)){return item;} } return null;
}
public A withWeeks(List weeks){
this.weeks.clear();
if (weeks != null) {for (String item : weeks){this.addToWeeks(item);}} return (A) this;
}
public A withWeeks(String... weeks){
this.weeks.clear(); if (weeks != null) {for (String item :weeks){ this.addToWeeks(item);}} return (A) this;
}
public Boolean hasWeeks(){
return weeks!= null && !weeks.isEmpty();
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PipelineTriggeScheduleFluentImpl that = (PipelineTriggeScheduleFluentImpl) o;
if (times != null ? !times.equals(that.times) :that.times != null) return false;
if (weeks != null ? !weeks.equals(that.weeks) :that.weeks != null) return false;
return true;
}
}