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

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

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);
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy