public class CustomPreconditions extends Object
Preconditions
.Constructor and Description |
---|
CustomPreconditions() |
Modifier and Type | Method and Description |
---|---|
static void |
checkOptionalString(String value,
int maxLength)
Checks whether
value validates as an optional string. |
static void |
checkRequiredString(String value)
Checks whether
value validates as a required string. |
static void |
checkRequiredString(String value,
int maxLength)
Checks whether
value validates as a required string. |
public static void checkRequiredString(String value)
value
validates as a required string. This method duplicates the logic of
the RequiredString
annotation and exists only to
support cases where annotations cannot be used.value
- the value to checkIllegalArgumentException
- if value
is blankpublic static void checkRequiredString(String value, int maxLength)
value
validates as a required string. This method duplicates the logic of
the RequiredString
annotation and exists only to
support cases where annotations cannot be used.value
- the value to checkmaxLength
- the maximum allowed string lengthIllegalArgumentException
- if value
is blank or longer than maxLength
characterspublic static void checkOptionalString(String value, int maxLength)
value
validates as an optional string. This method duplicates the logic of
the OptionalString
annotation and exists only to
support cases where annotations cannot be used.value
- the value to checkmaxLength
- the maximum allowed string lengthIllegalArgumentException
- if value
trims to the empty string or longer than maxLength
characters. null
is allowed.Copyright © 2024 Atlassian. All rights reserved.