functionalj.lens.lenses.java.time.PeriodLens 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.Period;
import functionalj.lens.core.LensSpec;
import functionalj.lens.lenses.IntegerLens;
import functionalj.lens.lenses.ObjectLensImpl;
public class PeriodLens
extends
ObjectLensImpl
implements
PeriodAccess {
public static final PeriodLens thePeriod = new PeriodLens(LensSpec.of(Period.class));
public final IntegerLens years = createSubLens(Period::getYears, Period::withYears, IntegerLens::of);
public final IntegerLens months = createSubLens(Period::getMonths, Period::withMonths, IntegerLens::of);
public final IntegerLens days = createSubLens(Period::getDays, Period::withDays, IntegerLens::of);
public static PeriodLens of(LensSpec spec) {
return new PeriodLens(spec);
}
public PeriodLens(LensSpec spec) {
super(spec);
}
}