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

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

package functionalj.lens.lenses.java.time;

import java.time.chrono.IsoEra;
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 lombok.val;

@FunctionalInterface
public interface IsoEraAccess
                    extends AnyAccess     
                    ,       EraAccess     
                    ,       ConcreteAccess> {
    
    public static  IsoEraAccess of(Function func) {
        return func::apply;
    }
    
    public default IsoEraAccess newAccess(Function accessToValue) {
        return accessToValue::apply;
    }
    
    public default IntegerAccess getValue() {
        return host -> {
            val value = apply(host);
            return value.getValue();
        };
    }
    
    public default BooleanAccess isBce() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.BCE;
        };
    }
    public default BooleanAccess isCe() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.CE;
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy