functionalj.lens.Accesses 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;
import static functionalj.lens.core.LensSpec.selfRead;
import static functionalj.lens.core.LensSpec.selfWrite;
import java.util.List;
import functionalj.lens.core.LensSpec;
import functionalj.lens.core.LensSpecParameterized;
import functionalj.lens.core.LensSpecParameterized2;
import functionalj.lens.core.LensType;
import functionalj.lens.core.LensUtils;
import functionalj.lens.lenses.AnyAccess;
import functionalj.lens.lenses.AnyLens;
import functionalj.lens.lenses.ListLens;
import functionalj.lens.lenses.ObjectLens;
import functionalj.lens.lenses.Tuple2Lens;
import functionalj.tuple.Tuple2;
public class Accesses {
//== Internal use only ==
public static class TheListLens implements ListLens, Object, ObjectLens, Object>> {
private static final LensSpecParameterized, List>, Object, ObjectLens, Object>>
common = LensUtils.createLensSpecParameterized(selfRead(), selfWrite(), ObjectLens::of);
public , T>, SL extends AnyLens, T>>
ListLens, T, SL> of(LensType, T, SA, SL> type) {
LensSpecParameterized, List, T, SL> spec
= LensUtils.createLensSpecParameterized(LensSpec.selfRead(), LensSpec.selfWrite(), s -> type.newLens(s));
ListLens, T, SL> listLens = ListLens.of(spec);
return listLens;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public LensSpecParameterized, List