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

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

There is a newer version: 1.0.17
Show newest version
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);
        };
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy