java.lang.Object
io.aiven.commons.kafka.config.validator.ScaleValidator
All Implemented Interfaces:
org.apache.kafka.common.config.ConfigDef.Validator

public class ScaleValidator extends Object implements org.apache.kafka.common.config.ConfigDef.Validator
Validates input is within ranges for specific scale values.
  • Method Details

    • atLeast

      public static ScaleValidator atLeast(Number min, List<Scale> possibleScales)
      A scale range that checks only the lower bound
      Parameters:
      min - The minimum acceptable number of bytes
      possibleScales - The list of potential scale values.
      Returns:
      A scale validator that requires at least the min number.
    • between

      public static ScaleValidator between(Number min, Number max, List<Scale> possibleScales)
      A scale range that checks both the upper and lower bound.
      Parameters:
      min - the minimum acceptable number of bytes.
      max - the maximum acceptable number of bytes.
      possibleScales - The list of potential scale values.
      Returns:
      A scale validator that requires a value between the min and max numbers inclusive.
    • ensureValid

      public void ensureValid(String name, Object value)
      Specified by:
      ensureValid in interface org.apache.kafka.common.config.ConfigDef.Validator
    • toString

      public String toString()
      Overrides:
      toString in class Object