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

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

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

import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
import java.util.function.Function;

import functionalj.lens.lenses.AnyAccess;
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 ValueRangeAccess
                    extends AnyAccess
                    ,       ConcreteAccess> {
    
    public static  ValueRangeAccess of(Function func) {
        return func::apply;
    }
    
    public default ValueRangeAccess newAccess(Function accessToValue) {
        return host -> accessToValue.apply(host);
    }
    
    public default BooleanAccessPrimitive isFixed() {
        return host -> {
            val value = apply(host);
            return value.isFixed();
        };
    }
    public default LongAccessPrimitive getMinimum() {
        return host -> {
            val value = apply(host);
            return value.getMinimum();
        };
    }
    public default LongAccessPrimitive getLargestMinimum() {
        return host -> {
            val value = apply(host);
            return value.getLargestMinimum();
        };
    }
    public default LongAccessPrimitive getSmallestMaximum() {
        return host -> {
            val value = apply(host);
            return value.getSmallestMaximum();
        };
    }
    public default LongAccessPrimitive getMaximum() {
        return host -> {
            val value = apply(host);
            return value.getMaximum();
        };
    }
    public default BooleanAccessPrimitive isIntValue() {
        return host -> {
            val value = apply(host);
            return value.isIntValue();
        };
    }
    public default BooleanAccessPrimitive isValidValue(long value) {
        return host -> {
            return apply(host)
                    .isValidValue(value);
        };
    }
    public default BooleanAccessPrimitive isValidIntValue(long value) {
        return host -> {
            return apply(host)
                    .isValidIntValue(value);
        };
    }
    public default LongAccessPrimitive checkValidValue(long value, TemporalField field) {
        return host -> {
            return apply(host)
                    .checkValidValue(value, field);
        };
    }
    public default IntegerAccessPrimitive checkValidIntValue(long value, TemporalField field) {
        return host -> {
            return apply(host)
                    .checkValidIntValue(value, field);
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy