Class BeanValidationUtils

java.lang.Object
org.instancio.internal.util.BeanValidationUtils

public final class BeanValidationUtils extends Object
  • Method Details

    • calculateRange

      public static Range<Integer> calculateRange(int min, int max, int maxLimit)
      Attempts to calculate a reasonable range for the given min/max values. For example, the Size annotation has a default max value of Integer.MAX_VALUE.

      Note: if min is 0, will return min 1, unless max is also zero.

      Parameters:
      min - value specified by an annotation
      max - value specified by an annotation
      maxLimit - when min is zero, limit max to this value
      Returns:
      a range containing the same values as provided, or an updated range with new max, smaller than the original.
    • setNonNullablePrimitive

      public static void setNonNullablePrimitive(GeneratorSpec<?> spec, Field field)