functionalj.lens.lenses.java.time.DurationLens 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.DayOfWeek;
import java.time.Duration;
import functionalj.lens.core.LensSpec;
import functionalj.lens.lenses.IntegerLens;
import functionalj.lens.lenses.LongLens;
import functionalj.lens.lenses.ObjectLensImpl;
public class DurationLens
extends ObjectLensImpl
implements DurationAccess {
public static final DurationLens theDuration = new DurationLens(LensSpec.of(Duration.class));
public final LongLens seconds = createSubLens(Duration::getSeconds, Duration::withSeconds, LongLens::of);
public final IntegerLens nanos = createSubLens(Duration::getNano, Duration::withNanos, IntegerLens::of);
public static DayOfWeekLens of(LensSpec spec) {
return new DayOfWeekLens(spec);
}
public DurationLens(LensSpec spec) {
super(spec);
}
}