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

functionalj.lens.lenses.java.time.MonthAccess Maven / Gradle / Ivy

There is a newer version: 1.0.17
Show newest version
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.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccess;
import functionalj.lens.lenses.LongAccess;
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 BooleanAccess isJanuary() {
        return host -> {
            val value = apply(host);
            return value == Month.JANUARY;
        };
    }
    public default BooleanAccess isFebruary() {
        return host -> {
            val value = apply(host);
            return value == Month.FEBRUARY;
        };
    }
    public default BooleanAccess isMarch() {
        return host -> {
            val value = apply(host);
            return value == Month.MARCH;
        };
    }
    public default BooleanAccess isApril() {
        return host -> {
            val value = apply(host);
            return value == Month.APRIL;
        };
    }
    public default BooleanAccess isMay() {
        return host -> {
            val value = apply(host);
            return value == Month.MAY;
        };
    }
    public default BooleanAccess isJune() {
        return host -> {
            val value = apply(host);
            return value == Month.JUNE;
        };
    }
    public default BooleanAccess isJuly() {
        return host -> {
            val value = apply(host);
            return value == Month.JULY;
        };
    }
    public default BooleanAccess isAugust() {
        return host -> {
            val value = apply(host);
            return value == Month.AUGUST;
        };
    }
    public default BooleanAccess isSeptember() {
        return host -> {
            val value = apply(host);
            return value == Month.SEPTEMBER;
        };
    }
    public default BooleanAccess isOctober() {
        return host -> {
            val value = apply(host);
            return value == Month.OCTOBER;
        };
    }
    public default BooleanAccess isNovember() {
        return host -> {
            val value = apply(host);
            return value == Month.NOVEMBER;
        };
    }
    public default BooleanAccess isDecember() {
        return host -> {
            val value = apply(host);
            return value == Month.DECEMBER;
        };
    }
    
    public default IntegerAccess 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 BooleanAccess 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 IntegerAccess get(TemporalField field) {
        return host -> {
            val value = apply(host);
            return value.get(field);
        };
    }
    public default LongAccess 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 IntegerAccess length(boolean leapYear) {
        return host -> {
            val value = apply(host);
            return value.length(leapYear);
        };
    }
    public default IntegerAccess minLength() {
        return host -> {
            val value = apply(host);
            return value.minLength();
        };
    }
    public default IntegerAccess maxLength() {
        return host -> {
            val value = apply(host);
            return value.maxLength();
        };
    }
    public default IntegerAccess 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 IntegerAccess 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);
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy