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.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;
};
}
}