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

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

There is a newer version: 1.0.17
Show newest version
package functionalj.lens.lenses.java.time;

import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

import functionalj.lens.core.LensSpec;
import functionalj.lens.lenses.ObjectLensImpl;

public class OffsetDateTimeLens
                extends    ObjectLensImpl
                implements OffsetDateTimeAccess {
                
    public static final OffsetDateTimeLens theOffsetDateTime
                            = new OffsetDateTimeLens(LensSpec.of(OffsetDateTime.class));
    
    public final LocalDateTimeLens dateTime 
                    = createSubLens(
                            OffsetDateTime::toLocalDateTime, 
                            (OffsetDateTime odt, LocalDateTime dt) -> OffsetDateTime.of(dt, odt.getOffset()),
                            LocalDateTimeLens::new);
    
    public final ZoneOffsetLens offset
                    = createSubLens(
                            OffsetDateTime::getOffset,
                            (OffsetDateTime odt, ZoneOffset zo) -> OffsetDateTime.of(odt.toLocalDateTime(), zo),
                            ZoneOffsetLens::new);
    
    public static  OffsetDateTimeLens of(LensSpec spec) {
        return new OffsetDateTimeLens(spec);
    }
    
    public OffsetDateTimeLens(LensSpec spec) {
        super(spec);
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy