functionalj.lens.lenses.java.time.OffsetDateTimeLens 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.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);
}
}