java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.klojang.check.aux.DuplicateValueException
- All Implemented Interfaces:
Serializable
Indicates that insertion into a Map,
Set or some other uniqueness-enforcing data structure
failed because the value to be inserted turned out to be a duplicate. Klojang
Check does not itself ever throw a
DuplicateValueException
, but the error
condition it represents is general and important enough to merit inclusion as a
common exception in the CommonExceptions
class.
Check.that(arg).isNot(keyIn(), map, duplicateKey(arg));
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Symbolic constants for the intended usage of the value. -
Constructor Summary
ConstructorDescriptionDefault constructor.DuplicateValueException
(String message) Creates a newDuplicateValueException
with the specified message.Creates a newDuplicateValueException
.DuplicateValueException
(DuplicateValueException.Usage usage, Object duplicate) Creates a newDuplicateValueException
for the specified value.DuplicateValueException
(DuplicateValueException.Usage usage, Collection<Object> duplicates) Creates a newDuplicateValueException
for the specified values. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DuplicateValueException
public DuplicateValueException()Default constructor. -
DuplicateValueException
Creates a newDuplicateValueException
with the specified message.- Parameters:
message
- the message
-
DuplicateValueException
Creates a newDuplicateValueException
.- Parameters:
usage
- the intended usage of the value
-
DuplicateValueException
Creates a newDuplicateValueException
for the specified value.- Parameters:
usage
- the intended usage of the valueduplicate
- the duplicate value.
-
DuplicateValueException
Creates a newDuplicateValueException
for the specified values.- Parameters:
usage
- the intended usage of the valuesduplicates
- the duplicate values.
-