functionalj.lens.lenses.java.time.DurationLens Maven / Gradle / Ivy
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);
}
}