functionalj.lens.lenses.java.time.ValueRangeAccess 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.temporal.TemporalField;
import java.time.temporal.ValueRange;
import java.util.function.Function;
import functionalj.lens.lenses.AnyAccess;
import functionalj.lens.lenses.BooleanAccessPrimitive;
import functionalj.lens.lenses.ConcreteAccess;
import functionalj.lens.lenses.IntegerAccessPrimitive;
import functionalj.lens.lenses.LongAccessPrimitive;
import lombok.val;
public interface ValueRangeAccess
extends AnyAccess
, ConcreteAccess> {
public static ValueRangeAccess of(Function func) {
return func::apply;
}
public default ValueRangeAccess newAccess(Function accessToValue) {
return host -> accessToValue.apply(host);
}
public default BooleanAccessPrimitive isFixed() {
return host -> {
val value = apply(host);
return value.isFixed();
};
}
public default LongAccessPrimitive getMinimum() {
return host -> {
val value = apply(host);
return value.getMinimum();
};
}
public default LongAccessPrimitive getLargestMinimum() {
return host -> {
val value = apply(host);
return value.getLargestMinimum();
};
}
public default LongAccessPrimitive getSmallestMaximum() {
return host -> {
val value = apply(host);
return value.getSmallestMaximum();
};
}
public default LongAccessPrimitive getMaximum() {
return host -> {
val value = apply(host);
return value.getMaximum();
};
}
public default BooleanAccessPrimitive isIntValue() {
return host -> {
val value = apply(host);
return value.isIntValue();
};
}
public default BooleanAccessPrimitive isValidValue(long value) {
return host -> {
return apply(host)
.isValidValue(value);
};
}
public default BooleanAccessPrimitive isValidIntValue(long value) {
return host -> {
return apply(host)
.isValidIntValue(value);
};
}
public default LongAccessPrimitive checkValidValue(long value, TemporalField field) {
return host -> {
return apply(host)
.checkValidValue(value, field);
};
}
public default IntegerAccessPrimitive checkValidIntValue(long value, TemporalField field) {
return host -> {
return apply(host)
.checkValidIntValue(value, field);
};
}
}