functionalj.lens.lenses.java.time.IsoEraAccess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalj-core Show documentation
Show all versions of functionalj-core Show documentation
The module for FunctionalJ Core.
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;
};
}
}