Package com.exedio.cope
Class MandatoryViolationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.exedio.cope.ConstraintViolationException
com.exedio.cope.MandatoryViolationException
- All Implemented Interfaces:
Serializable
Signals, that an attempt to write an field has been failed,
because it cannot be written with a null value.
This exception will be thrown by
Item.set
and item constructors
if that field is mandatory
.
This exception is also thrown for empty strings if
Model.supportsEmptyStrings()
is false.
- Author:
- Ralf Wiebicke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMandatoryViolationException
(Feature feature, Settable<?> settable, Item item) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic MandatoryViolationException
Creates a new MandatoryViolationException with the necessary information about the violation.Returns the feature, that was attempted to be written.Deprecated.Renamed togetFeature()
.getMessage
(boolean withFeature) static void
requireNonNull
(Object value, Feature feature, Item item) Methods inherited from class com.exedio.cope.ConstraintViolationException
getItem, getItemID, getItemPhrase, getItemText, getMessage, getMessageWithoutFeature
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MandatoryViolationException
Deprecated.Usecreate(Feature, Item)
instead.
-
-
Method Details
-
requireNonNull
-
create
Creates a new MandatoryViolationException with the necessary information about the violation.- Parameters:
item
- initializes, what is returned byConstraintViolationException.getItem()
.feature
- initializes, what is returned bygetFeature()
.
-
getFeature
Returns the feature, that was attempted to be written.- Specified by:
getFeature
in classConstraintViolationException
-
getMessage
- Specified by:
getMessage
in classConstraintViolationException
-
getMandatoryAttribute
Deprecated.Renamed togetFeature()
.
-
create(Feature, Item)
instead.