functionalj.lens.lenses.java.time.EraAccess 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.Era;
import java.time.format.TextStyle;
import java.util.Locale;
import java.util.function.Function;
import functionalj.lens.lenses.AnyAccess;
import functionalj.lens.lenses.IntegerAccessPrimitive;
import functionalj.lens.lenses.StringAccess;
import lombok.val;
@FunctionalInterface
public interface EraAccess
extends AnyAccess
, TemporalAccessorAccess
, TemporalAdjusterAccess {
public static EraAccess of(Function func) {
return func::apply;
}
public default EraAccess newAccess(Function accessToValue) {
return host -> accessToValue.apply(host);
}
public default IntegerAccessPrimitive getValue() {
return host -> {
val value = apply(host);
return value.getValue();
};
}
public default StringAccess getDisplayName(TextStyle style, Locale locale) {
return host -> {
val value = apply(host);
return value.getDisplayName(style, locale);
};
}
}