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

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

There is a newer version: 1.0.17
Show newest version
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.BooleanAccessPrimitive;
import functionalj.lens.lenses.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccessPrimitive;
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 IntegerAccessPrimitive getValue() {
        return host -> {
            val value = apply(host);
            return value.getValue();
        };
    }
    
    public default BooleanAccessPrimitive isBce() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.BCE;
        };
    }
    public default BooleanAccessPrimitive isCe() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.CE;
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy