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

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

There is a newer version: 1.0.17
Show newest version
package functionalj.lens.lenses.java.time;

import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
import java.time.chrono.Era;
import java.time.chrono.IsoChronology;
import java.time.format.ResolverStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.util.Map;
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.ListAccess;
import lombok.val;

@FunctionalInterface
public interface IsoChronologyAccess
                    extends AnyAccess       
                    ,       ChronologyAccess
                    ,       ConcreteAccess  > {
    
    public static  IsoChronologyAccess of(Function func) {
        return func::apply;
    }
    
    public default IsoChronologyAccess newAccess(Function accessToValue) {
        return host -> accessToValue.apply(host);
    }
    
    public default LocalDateAccess date(Era era, int yearOfEra, int month, int dayOfMonth) {
        return host -> {
            val value = apply(host);
            return value.date(era, yearOfEra, month, dayOfMonth);
        };
    }
    public default LocalDateAccess date(int prolepticYear, int month, int dayOfMonth) {
        return host -> {
            val value = apply(host);
            return value.date(prolepticYear, month, dayOfMonth);
        };
    }
    public default LocalDateAccess dateYearDay(Era era, int yearOfEra, int dayOfYear) {
        return host -> {
            val value = apply(host);
            return value.dateYearDay(era, yearOfEra, dayOfYear);
        };
    }
    public default LocalDateAccess dateYearDay(int prolepticYear, int dayOfYear) {
        return host -> {
            val value = apply(host);
            return value.dateYearDay(prolepticYear, dayOfYear);
        };
    }
    public default LocalDateAccess dateEpochDay(long epochDay) {
        return host -> {
            val value = apply(host);
            return value.dateEpochDay(epochDay);
        };
    }
    public default LocalDateAccess date(TemporalAccessor temporal) {
        return host -> {
            val value = apply(host);
            return value.date(temporal);
        };
    }
    public default LocalDateTimeAccess localDateTime(TemporalAccessor temporal) {
        return host -> {
            val value = apply(host);
            return value.localDateTime(temporal);
        };
    }
    public default ZonedDateTimeAccess zonedDateTime(TemporalAccessor temporal) {
        return host -> {
            val value = apply(host);
            return value.zonedDateTime(temporal);
        };
    }
    public default ZonedDateTimeAccess  zonedDateTime(Instant instant, ZoneId zone) {
        return host -> {
            val value = apply(host);
            return value.zonedDateTime(instant, zone);
        };
    }
    public default LocalDateAccess dateNow() {
        return host -> {
            val value = apply(host);
            return value.dateNow();
        };
    }
    public default LocalDateAccess dateNow(ZoneId zone) {
        return host -> {
            val value = apply(host);
            return value.dateNow(zone);
        };
    }
    public default LocalDateAccess dateNow(Clock clock) {
        return host -> {
            val value = apply(host);
            return value.dateNow(clock);
        };
    }
    public default BooleanAccess isLeapYear(long prolepticYear) {
        return host -> {
            val value = apply(host);
            return value.isLeapYear(prolepticYear);
        };
    }
    public default IntegerAccess prolepticYear(Era era, int yearOfEra) {
        return host -> {
            val value = apply(host);
            return value.prolepticYear(era, yearOfEra);
        };
    }
    public default IsoEraAccess eraOf(int eraValue) {
        return host -> {
            val value = apply(host);
            return value.eraOf(eraValue);
        };
    }
    public default ListAccess> eras() {
        return ListAccess.of(host -> IsoChronologyAccess.this.apply(host).eras(), EraAccess::of);
    }
    public default LocalDateAccess resolveDate(Map fieldValues, ResolverStyle resolverStyle) {
        return host -> {
            val value = apply(host);
            return value.resolveDate(fieldValues, resolverStyle);
        };
    }
    public default ValueRangeAccess range(ChronoField field) {
        return host -> {
            val value = apply(host);
            return value.range(field);
        };
    }
    public default PeriodAccess period(int years, int months, int days) {
        return host -> {
            val value = apply(host);
            return value.period(years, months, days);
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy