Module org.tquadrat.foundation.base
Class CharSequenceTooLongException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.tquadrat.foundation.exception.ValidationException
org.tquadrat.foundation.exception.CharSequenceTooLongException
- All Implemented Interfaces:
Serializable
@ClassVersion(sourceVersion="$Id: CharSequenceTooLongException.java 1060 2023-09-24 19:21:40Z tquadrat $")
@API(status=STABLE,
since="0.0.5")
public final class CharSequenceTooLongException
extends ValidationException
This is a specialized implementation for the
IllegalArgumentException
that should be used instead of the latter in cases where a
CharSequence
provided as a method argument is too long according to some external
constraints, like the column definition of a database.- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: CharSequenceTooLongException.java 1060 2023-09-24 19:21:40Z tquadrat $
- Since:
- 0.0.5
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.exception.CharSequenceTooLongException"
-
Field Summary
Fields inherited from class org.tquadrat.foundation.exception.ValidationException
MSG_ValidationFailed
-
Constructor Summary
ConstructorsConstructorDescriptionCharSequenceTooLongException
(int maxLength) Creates a new instance ofCharSequenceTooLongException
.CharSequenceTooLongException
(String argName, int maxLength) Creates a new instance ofCharSequenceTooLongException
. -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
checkLength
(int maxLength) Checks the given value.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CharSequenceTooLongException
Creates a new instance ofCharSequenceTooLongException
.- Parameters:
argName
- The name of the argument whose value was too long.maxLength
- The maximum length.
-
CharSequenceTooLongException
Creates a new instance ofCharSequenceTooLongException
.- Parameters:
maxLength
- The maximum length.
-
-
Method Details
-
checkLength
Checks the given value.- Parameters:
maxLength
- The provided legal length for a text.- Returns:
- The given value.
- Throws:
ValidationException
- The given value was less than 1.
-