Class StrSchema

java.lang.Object
jsonvalues.spec.StrSchema

public final class StrSchema extends Object
A class representing the schema for string values in a JSON structure. It allows setting constraints such as minimum and maximum length, a pattern to match, and a format.
  • Method Details

    • withLength

      public static StrSchema withLength(int minLength, int maxLength)
    • withMinLength

      public static StrSchema withMinLength(int minLength)
    • withMaxLength

      public static StrSchema withMaxLength(int maxLength)
    • withPattern

      public static StrSchema withPattern(String pattern)
    • setMinLength

      public StrSchema setMinLength(int minLength)
      Sets the minimum length for string values in the schema.
      Parameters:
      minLength - The minimum length (inclusive).
      Returns:
      This StrSchema instance for method chaining.
    • setMaxLength

      public StrSchema setMaxLength(int maxLength)
      Sets the maximum length for string values in the schema.
      Parameters:
      maxLength - The maximum length (inclusive).
      Returns:
      This StrSchema instance for method chaining.
    • setPattern

      public StrSchema setPattern(String pattern)
      Sets a pattern that the string values must match.
      Parameters:
      pattern - The regular expression pattern.
      Returns:
      This StrSchema instance for method chaining.
    • setFormat

      public StrSchema setFormat(String format)
      Sets a format for string values based on predefined formats.
      Parameters:
      format - The predefined format from the BUILT_INT_FORMAT enum.
      Returns:
      This StrSchema instance for method chaining.