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.BooleanAccess;
import functionalj.lens.lenses.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccess;
import functionalj.lens.lenses.LongAccess;
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 BooleanAccess isFixed() {
        return host -> {
            val value = apply(host);
            return value.isFixed();
        };
    }
    public default LongAccess getMinimum() {
        return host -> {
            val value = apply(host);
            return value.getMinimum();
        };
    }
    public default LongAccess getLargestMinimum() {
        return host -> {
            val value = apply(host);
            return value.getLargestMinimum();
        };
    }
    public default LongAccess getSmallestMaximum() {
        return host -> {
            val value = apply(host);
            return value.getSmallestMaximum();
        };
    }
    public default LongAccess getMaximum() {
        return host -> {
            val value = apply(host);
            return value.getMaximum();
        };
    }
    public default BooleanAccess isIntValue() {
        return host -> {
            val value = apply(host);
            return value.isIntValue();
        };
    }
    public default BooleanAccess isValidValue(long value) {
        return host -> {
            return apply(host)
                    .isValidValue(value);
        };
    }
    public default BooleanAccess isValidIntValue(long value) {
        return host -> {
            return apply(host)
                    .isValidIntValue(value);
        };
    }
    public default LongAccess checkValidValue(long value, TemporalField field) {
        return host -> {
            return apply(host)
                    .checkValidValue(value, field);
        };
    }
    public default IntegerAccess checkValidIntValue(long value, TemporalField field) {
        return host -> {
            return apply(host)
                    .checkValidIntValue(value, field);
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy