functionalj.lens.lenses.java.time.MonthAccess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalj-core Show documentation
Show all versions of functionalj-core Show documentation
The module for FunctionalJ Core.
package functionalj.lens.lenses.java.time;
import java.time.Month;
import java.time.format.TextStyle;
import java.time.temporal.TemporalField;
import java.util.Locale;
import java.util.function.Function;
import functionalj.lens.lenses.AnyAccess;
import functionalj.lens.lenses.BooleanAccess;
import functionalj.lens.lenses.BooleanAccessPrimitive;
import functionalj.lens.lenses.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccessPrimitive;
import functionalj.lens.lenses.LongAccessPrimitive;
import functionalj.lens.lenses.StringAccess;
import lombok.val;
@FunctionalInterface
public interface MonthAccess
extends AnyAccess
, TemporalAccessorAccess
, TemporalAdjusterAccess
, ConcreteAccess > {
public static MonthAccess of(Function func) {
return func::apply;
}
public default MonthAccess newAccess(Function accessToValue) {
return host -> accessToValue.apply(host);
}
public default BooleanAccessPrimitive isJanuary() {
return host -> {
val value = apply(host);
return value == Month.JANUARY;
};
}
public default BooleanAccessPrimitive isFebruary() {
return host -> {
val value = apply(host);
return value == Month.FEBRUARY;
};
}
public default BooleanAccessPrimitive isMarch() {
return host -> {
val value = apply(host);
return value == Month.MARCH;
};
}
public default BooleanAccessPrimitive isApril() {
return host -> {
val value = apply(host);
return value == Month.APRIL;
};
}
public default BooleanAccessPrimitive isMay() {
return host -> {
val value = apply(host);
return value == Month.MAY;
};
}
public default BooleanAccessPrimitive isJune() {
return host -> {
val value = apply(host);
return value == Month.JUNE;
};
}
public default BooleanAccessPrimitive isJuly() {
return host -> {
val value = apply(host);
return value == Month.JULY;
};
}
public default BooleanAccessPrimitive isAugust() {
return host -> {
val value = apply(host);
return value == Month.AUGUST;
};
}
public default BooleanAccessPrimitive isSeptember() {
return host -> {
val value = apply(host);
return value == Month.SEPTEMBER;
};
}
public default BooleanAccessPrimitive isOctober() {
return host -> {
val value = apply(host);
return value == Month.OCTOBER;
};
}
public default BooleanAccessPrimitive isNovember() {
return host -> {
val value = apply(host);
return value == Month.NOVEMBER;
};
}
public default BooleanAccessPrimitive isDecember() {
return host -> {
val value = apply(host);
return value == Month.DECEMBER;
};
}
public default IntegerAccessPrimitive getValue() {
return host -> {
val value = apply(host);
return value.getValue();
};
}
public default StringAccess getDisplayName(TextStyle style, Locale locale) {
return host -> {
val value = apply(host);
return value.getDisplayName(style, locale);
};
}
public default BooleanAccessPrimitive thatIsSupported(TemporalField field) {
return host -> {
val value = apply(host);
return value.isSupported(field);
};
}
public default ValueRangeAccess range(TemporalField field) {
return host -> {
val value = apply(host);
return value.range(field);
};
}
public default IntegerAccessPrimitive get(TemporalField field) {
return host -> {
val value = apply(host);
return value.get(field);
};
}
public default LongAccessPrimitive getLong(TemporalField field) {
return host -> {
val value = apply(host);
return value.getLong(field);
};
}
public default MonthAccess plus(long months) {
return host -> {
val value = apply(host);
return value.plus(months);
};
}
public default MonthAccess minus(long months) {
return host -> {
val value = apply(host);
return value.minus(months);
};
}
public default IntegerAccessPrimitive length(boolean leapYear) {
return host -> {
val value = apply(host);
return value.length(leapYear);
};
}
public default IntegerAccessPrimitive minLength() {
return host -> {
val value = apply(host);
return value.minLength();
};
}
public default IntegerAccessPrimitive maxLength() {
return host -> {
val value = apply(host);
return value.maxLength();
};
}
public default IntegerAccessPrimitive firstDayOfYear(boolean leapYear) {
return host -> {
val value = apply(host);
return value.firstDayOfYear(leapYear);
};
}
public default MonthAccess firstMonthOfQuarter() {
return host -> {
val value = apply(host);
return value.firstMonthOfQuarter();
};
}
public default IntegerAccessPrimitive compareTo(Month other) {
return host -> {
val value = apply(host);
return value.compareTo(other);
};
}
public default BooleanAccess thatGreaterThan(Month anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) > 0);
}
public default BooleanAccess thatLessThan(Month anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) < 0);
}
public default BooleanAccess thatGreaterThanOrEqualsTo(Month anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) >= 0);
}
public default BooleanAccess thatLessThanOrEqualsTo(Month anotherValue) {
return booleanAccess(false, any -> any.compareTo(anotherValue) <= 0);
}
}