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

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

package functionalj.lens.lenses.java.time;

import java.time.LocalDate;
import java.time.OffsetTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
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.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccess;
import functionalj.lens.lenses.StringAccess;
import lombok.val;

@FunctionalInterface
public interface OffsetTimeAccess
                    extends AnyAccess             
                    ,       TemporalAccess        
                    ,       TemporalAdjusterAccess
                    ,       ConcreteAccess        > {
    
    public static  OffsetTimeAccess of(Function func) {
        return func::apply;
    }
    
    public default OffsetTimeAccess newAccess(Function accessToValue) {
        return host -> accessToValue.apply(host);
    }
    
    public default ZoneOffsetAccess getOffset() {
        return host -> {
            val value = apply(host);
            return value.getOffset();
        };
    }
    public default OffsetTimeAccess withOffsetSameLocal(ZoneOffset offset) {
        return host -> {
            val value = apply(host);
            return value.withOffsetSameLocal(offset);
        };
    }
    public default OffsetTimeAccess withOffsetSameInstant(ZoneOffset offset) {
        return host -> {
            val value = apply(host);
            return value.withOffsetSameInstant(offset);
        };
    }
    public default LocalTimeAccess toLocalTime() {
        return host -> {
            val value = apply(host);
            return value.toLocalTime();
        };
    }
    public default IntegerAccess getHour() {
        return host -> {
            val value = apply(host);
            return value.getHour();
        };
    }
    public default IntegerAccess getMinute() {
        return host -> {
            val value = apply(host);
            return value.getMinute();
        };
    }
    public default IntegerAccess getSecond() {
        return host -> {
            val value = apply(host);
            return value.getSecond();
        };
    }
    public default IntegerAccess getNano() {
        return host -> {
            val value = apply(host);
            return value.getNano();
        };
    }
    @Override
    public default OffsetTimeAccess with(TemporalAdjuster adjuster) {
        return host -> {
            val value = apply(host);
            return value.with(adjuster);
        };
    }
    @Override
    public default OffsetTimeAccess with(TemporalField field, long newValue) {
        return host -> {
            val value = apply(host);
            return value.with(field, newValue);
        };
    }
    public default OffsetTimeAccess withHour(int hour) {
        return host -> {
            val value = apply(host);
            return value.withHour(hour);
        };
    }
    public default OffsetTimeAccess withMinute(int minute) {
        return host -> {
            val value = apply(host);
            return value.withMinute(minute);
        };
    }
    public default OffsetTimeAccess withSecond(int second) {
        return host -> {
            val value = apply(host);
            return value.withSecond(second);
        };
    }
    public default OffsetTimeAccess withNano(int nanoOfSecond) {
        return host -> {
            val value = apply(host);
            return value.withNano(nanoOfSecond);
        };
    }
    public default OffsetTimeAccess truncatedTo(TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.truncatedTo(unit);
        };
    }
    @Override
    public default OffsetTimeAccess plus(TemporalAmount amountToAdd) {
        return host -> {
            val value = apply(host);
            return value.plus(amountToAdd);
        };
    }
    @Override
    public default OffsetTimeAccess plus(long amountToAdd, TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.plus(amountToAdd, unit);
        };
    }
    public default OffsetTimeAccess plusHours(long hours) {
        return host -> {
            val value = apply(host);
            return value.plusHours(hours);
        };
    }
    public default OffsetTimeAccess plusMinutes(long minutes) {
        return host -> {
            val value = apply(host);
            return value.plusMinutes(minutes);
        };
    }
    public default OffsetTimeAccess plusSeconds(long seconds) {
        return host -> {
            val value = apply(host);
            return value.plusSeconds(seconds);
        };
    }
    public default OffsetTimeAccess plusNanos(long nanos) {
        return host -> {
            val value = apply(host);
            return value.plusNanos(nanos);
        };
    }
    @Override
    public default OffsetTimeAccess minus(TemporalAmount amountToSubtract) {
        return host -> {
            val value = apply(host);
            return value.minus(amountToSubtract);
        };
    }
    @Override
    public default OffsetTimeAccess minus(long amountToSubtract, TemporalUnit unit) {
        return host -> {
            val value = apply(host);
            return value.minus(amountToSubtract, unit);
        };
    }
    public default OffsetTimeAccess minusHours(long hours) {
        return host -> {
            val value = apply(host);
            return value.minusHours(hours);
        };
    }
    public default OffsetTimeAccess minusMinutes(long minutes) {
        return host -> {
            val value = apply(host);
            return value.minusMinutes(minutes);
        };
    }
    public default OffsetTimeAccess minusSeconds(long seconds) {
        return host -> {
            val value = apply(host);
            return value.minusSeconds(seconds);
        };
    }
    public default OffsetTimeAccess minusNanos(long nanos) {
        return host -> {
            val value = apply(host);
            return value.minusNanos(nanos);
        };
    }
    public default StringAccess format(DateTimeFormatter formatter) {
        return host -> {
            val value = apply(host);
            return value.format(formatter);
        };
    }
    public default OffsetDateTimeAccess atDate(LocalDate date) {
        return host -> {
            val value = apply(host);
            return value.atDate(date);
        };
    }
    
    public default IntegerAccess compareTo(OffsetTime other) {
        return host -> {
            val value = apply(host);
            return value.compareTo(other);
        };
    }
    public default BooleanAccess thatGreaterThan(OffsetTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) > 0);
    }
    public default BooleanAccess thatLessThan(OffsetTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) < 0);
    }
    public default BooleanAccess thatGreaterThanOrEqualsTo(OffsetTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) >= 0);
    }
    public default BooleanAccess thatLessThanOrEqualsTo(OffsetTime anotherValue) {
        return booleanAccess(false, any -> any.compareTo(anotherValue) <= 0);
    }
    
    public default BooleanAccess thatIsAfter(OffsetTime other) {
        return host -> {
            val value = apply(host);
            return value.isAfter(other);
        };
    }
    public default BooleanAccess thatIsBefore(OffsetTime other) {
        return host -> {
            val value = apply(host);
            return value.isBefore(other);
        };
    }
    public default BooleanAccess thatIsEqual(OffsetTime other) {
        return host -> {
            val value = apply(host);
            return value.isEqual(other);
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy