| java.lang.Object |
| ↳ |
com.atlassian.stash.util.CustomPreconditions |
Class Overview
More precondition checks following the same pattern com.google.common.base.Preconditions uses.
Summary
| Public Methods |
|
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.
|
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
Public Constructors
public
CustomPreconditions
()
Public Methods
public
static
void
checkOptionalString
(String value, int maxLength)
Checks whether value validates as an optional string. This method duplicates the logic of
the OptionalString JSR-303 annotation and exists only to
support cases where JSR-303 annotations cannot be used.
Parameters
| value
| the value to check |
| maxLength
| the maximum allowed string length |
Throws
| IllegalArgumentException
| if value trims to the empty string or longer than maxLength characters. null is allowed.
|
public
static
void
checkRequiredString
(String value)
Checks whether value validates as a required string. This method duplicates the logic of
the RequiredString JSR-303 annotation and exists only to
support cases where JSR-303 annotations cannot be used.
Throws
| IllegalArgumentException
| if value is blank
|
public
static
void
checkRequiredString
(String value, int maxLength)
Checks whether value validates as a required string. This method duplicates the logic of
the RequiredString JSR-303 annotation and exists only to
support cases where JSR-303 annotations cannot be used.
Parameters
| value
| the value to check |
| maxLength
| the maximum allowed string length |
Throws
| IllegalArgumentException
| if value is blank or longer than maxLength characters
|