![JAR search and dependency download from the Maven repository](/logo.png)
com.mercateo.common.rest.schemagen.ValueConstraints Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common.rest.schemagen Show documentation
Show all versions of common.rest.schemagen Show documentation
Jersey add-on for dynamic link and schema building
package com.mercateo.common.rest.schemagen;
import java.util.Optional;
public class ValueConstraints {
private static final ValueConstraints EMPTY_CONSTRAINTS = new ValueConstraints();
private Optional max;
private Optional min;
public Optional getMax() {
return max;
}
public Optional getMin() {
return min;
}
public ValueConstraints(Optional max, Optional min) {
if (max.flatMap(x -> min.map(y -> y > x)).orElse(false)) {
throw new IllegalArgumentException(String.format(
"Minimum value %s is larger than maximum value %s", min.get(), max.get()));
}
this.max = max;
this.min = min;
}
public static ValueConstraints empty() {
return EMPTY_CONSTRAINTS;
}
private ValueConstraints() {
this.max = Optional.empty();
this.min = Optional.empty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy