Class AbstractStringMediator
java.lang.Object
ch.nolix.base.validation.base.AbstractMediator
ch.nolix.base.validation.object.AbstractObjectMediator<String>
ch.nolix.base.validation.object.AbstractStringMediator
- Direct Known Subclasses:
NamableStringMediator, StringMediator
A
AbstractStringMediator is a AbstractMediator for an
argument that is a String. A AbstractStringMediator is not
mutable.- Author:
- Silvan Wyss
-
Field Summary
Fields inherited from class AbstractMediator
DEFAULT_ARGUMENT_NAME -
Method Summary
Modifier and TypeMethodDescriptionvoidhasLength(int length) voidisEmpty()voidvoidvoidisNotLongerThan(int maxLength) voidisNotShorterThan(int minLength) voidvoidstartsWith(String prefix) Methods inherited from class AbstractObjectMediator
fulfills, hasSameStringRepresentationAs, hasStringRepresentation, is, isEqualTo, isNot, isNotEqualTo, isNotNull, isNull, isOfType
-
Method Details
-
hasLength
public void hasLength(int length) - Parameters:
length-- Throws:
RuntimeException- if the given length is negativeRuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatordoes not have the given length.
-
isEmpty
public void isEmpty()- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatoris nullNonEmptyArgumentException- if the argument of the currentAbstractStringMediatoris not empty.
-
isNotEmpty
public void isNotEmpty()- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatoris empty
-
isNotBlank
public void isNotBlank()- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatoris blank
-
isNotLongerThan
public void isNotLongerThan(int maxLength) - Parameters:
maxLength-- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatoris longer than the given max length says.
-
isNotShorterThan
public void isNotShorterThan(int minLength) - Parameters:
minLength-- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatoris shorter than the given min length says.
-
matches
- Parameters:
regularExpression-- Throws:
RuntimeException- if the argument of the currentAbstractStringMediatordoes not match the given regularExpression.
-
startsWith
- Parameters:
prefix-- Throws:
RuntimeException- if the given prefix is nullRuntimeException- if the argument of the currentAbstractStringMediatoris nullRuntimeException- if the argument of the currentAbstractStringMediatordoes not start with the given prefix.
-