Package jsonvalues.spec
Class StrSchema
java.lang.Object
jsonvalues.spec.StrSchema
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 Summary
Modifier and TypeMethodDescriptionSets a format for string values based on predefined formats.setMaxLength
(int maxLength) Sets the maximum length for string values in the schema.setMinLength
(int minLength) Sets the minimum length for string values in the schema.setPattern
(String pattern) Sets a pattern that the string values must match.static StrSchema
withLength
(int minLength, int maxLength) static StrSchema
withMaxLength
(int maxLength) static StrSchema
withMinLength
(int minLength) static StrSchema
withPattern
(String pattern)
-
Method Details
-
withLength
-
withMinLength
-
withMaxLength
-
withPattern
-
setMinLength
Sets the minimum length for string values in the schema.- Parameters:
minLength
- The minimum length (inclusive).- Returns:
- This StrSchema instance for method chaining.
-
setMaxLength
Sets the maximum length for string values in the schema.- Parameters:
maxLength
- The maximum length (inclusive).- Returns:
- This StrSchema instance for method chaining.
-
setPattern
Sets a pattern that the string values must match.- Parameters:
pattern
- The regular expression pattern.- Returns:
- This StrSchema instance for method chaining.
-
setFormat
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.
-