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

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

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

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalUnit;
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 lombok.val;


public interface LocalTimeAccess
                    extends AnyAccess             
                    ,       TemporalAccess        
                    ,       TemporalAdjusterAccess
                    ,       ConcreteAccess        > {
    
    public static  LocalTimeAccess of(Function func) {
        return func::apply;
    }
    
    public default LocalTimeAccess newAccess(Function accessToValue) {
        return host -> accessToValue.apply(host);
    }
    
    public default IntegerAccessPrimitive getHour() {
        return host -> {
            val value = apply(host);
            return value.getHour();
        };
    }
    public default IntegerAccessPrimitive getMinute() {
        return host -> {
            val value = apply(host);
            return value.getMinute();
        };
    }
    public default IntegerAccessPrimitive getSecond() {
        return host -> {
            val value = apply(host);
            return value.getSecond();
        };
    }
    public default IntegerAccessPrimitive getNano() {
        return host -> {
            val value = apply(host);
            return value.getNano();
        };
    }
    public default LocalTimeAccess with(TemporalAdjuster adjuster) {
        return host -> {
            val value = apply(host);
            return value.with(adjuster);
        };
    }
    public default LocalTimeAccess with(TemporalField field, long newValue) {
        return host -> {
            val value = apply(host);
            return value.with(field, newValue);
        };
    }
    public default LocalTimeAccess withHour(int hour) {
        return host -> {
            val value = apply(host);
            return value.withHour(hour);
        };
    }
    public default LocalTimeAccess withMinute(int minute) {
        return host -> {
            val value = apply(host);
            return value.withMinute(minute);
        };
    }
    public default LocalTimeAccess withSecond(int second) {
        return host -> {
            val value = apply(host);
            return value.withSecond(second);
        };
    }
    public default LocalTimeAccess withNano(int nanoOfSecond) {
        return host -> {
            val value = apply(host);
            return value.withNano(nanoOfSecond);
        };
    }
    public default LocalTimeAccess truncatedTo(TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.truncatedTo(unit);
        };
    }
    public default LocalTimeAccess plus(TemporalAmount amountToAdd) {
        return host -> {
            val value = apply(host);
            return value.plus(amountToAdd);
        };
    }
    public default LocalTimeAccess plus(long amountToAdd, TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.plus(amountToAdd, unit);
        };
    }
    public default LocalTimeAccess plusHours(long hoursToAdd) {
        return host -> {
            val value = apply(host);
            return value.plusHours(hoursToAdd);
        };
    }
    public default LocalTimeAccess plusMinutes(long minutesToAdd) {
        return host -> {
            val value = apply(host);
            return value.plusMinutes(minutesToAdd);
        };
    }
    public default LocalTimeAccess plusSeconds(long secondstoAdd) {
        return host -> {
            val value = apply(host);
            return value.plusSeconds(secondstoAdd);
        };
    }
    public default LocalTimeAccess plusNanos(long nanosToAdd) {
        return host -> {
            val value = apply(host);
            return value.plusNanos(nanosToAdd);
        };
    }
    public default LocalTimeAccess minus(TemporalAmount amountToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minus(amountToSubtract);
        };
    }
    public default LocalTimeAccess minus(long amountToSubtract, TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.minus(amountToSubtract, unit);
        };
    }
    public default LocalTimeAccess minusHours(long hoursToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minusHours(hoursToSubtract);
        };
    }
    public default LocalTimeAccess minusMinutes(long minutesToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minusMinutes(minutesToSubtract);
        };
    }
    public default LocalTimeAccess minusSeconds(long secondsToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minusSeconds(secondsToSubtract);
        };
    }
    public default LocalTimeAccess minusNanos(long nanosToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minusNanos(nanosToSubtract);
        };
    }
    
    public default LocalDateTimeAccess atDate(LocalDate date) {
        return host -> {
            val value = apply(host);
            return value.atDate(date);
        };
    }
    public default OffsetTimeAccess atOffset(ZoneOffset offset) {
        return host -> {
            val value = apply(host);
            return value.atOffset(offset);
        };
    }
    public default IntegerAccessPrimitive toSecondOfDay() {
        return host -> {
            val value = apply(host);
            return value.toSecondOfDay();
        };
    }
    public default LongAccessPrimitive toNanoOfDay() {
        return host -> {
            val value = apply(host);
            return value.toNanoOfDay();
        };
    }
    
    public default IntegerAccessPrimitive compareTo(LocalTime other) {
        return host -> {
            val value = apply(host);
            return value.compareTo(other);
        };
    }
    public default BooleanAccess thatGreaterThan(LocalTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) > 0);
    }
    public default BooleanAccess thatLessThan(LocalTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) < 0);
    }
    public default BooleanAccess thatGreaterThanOrEqualsTo(LocalTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) >= 0);
    }
    public default BooleanAccess thatLessThanOrEqualsTo(LocalTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) <= 0);
    }
    
    public default BooleanAccessPrimitive thatIsAfter(LocalTime other) {
        return host -> {
            val value = apply(host);
            return value.isAfter(other);
        };
    }
    public default BooleanAccessPrimitive thatIsBefore(LocalTime other) {
        return host -> {
            val value = apply(host);
            return value.isBefore(other);
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy