functionalj.lens.lenses.java.time.DayOfWeekAccess Maven / Gradle / Ivy
package functionalj.lens.lenses.java.time;
import java.time.DayOfWeek;
import java.util.function.Function;
import functionalj.lens.lenses.AnyAccess;
import functionalj.lens.lenses.BooleanAccess;
import functionalj.lens.lenses.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccess;
import lombok.val;
@FunctionalInterface
public interface DayOfWeekAccess
extends AnyAccess
, TemporalAccessorAccess
, TemporalAdjusterAccess
, ConcreteAccess > {
public static DayOfWeekAccess of(Function func) {
return func::apply;
}
public default DayOfWeekAccess newAccess(Function accessToValue) {
return host -> accessToValue.apply(host);
}
public default BooleanAccess isMonday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.MONDAY;
};
}
public default BooleanAccess isTuesday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.TUESDAY;
};
}
public default BooleanAccess isWednesday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.WEDNESDAY;
};
}
public default BooleanAccess isThursday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.THURSDAY;
};
}
public default BooleanAccess isFriday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.FRIDAY;
};
}
public default BooleanAccess isSaturday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.SATURDAY;
};
}
public default BooleanAccess isSunday() {
return host -> {
val value = apply(host);
return value == DayOfWeek.SUNDAY;
};
}
public default DayOfWeekAccess plus(long days) {
return host -> {
val value = apply(host);
return value.plus(days);
};
}
public default DayOfWeekAccess minus(long days) {
return host -> {
val value = apply(host);
return value.minus(days);
};
}
public default IntegerAccess compareTo(DayOfWeek other) {
return host -> {
val value = apply(host);
return value.compareTo(other);
};
}
public default BooleanAccess thatGreaterThan(DayOfWeek anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) > 0);
}
public default BooleanAccess thatLessThan(DayOfWeek anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) < 0);
}
public default BooleanAccess thatGreaterThanOrEqualsTo(DayOfWeek anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) >= 0);
}
public default BooleanAccess thatLessThanOrEqualsTo(DayOfWeek anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) <= 0);
}
}