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
public final class MandatoryViolationException extends ConstraintViolationException
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 byItem.set
and item constructors if that field ismandatory
.This exception is also thrown for empty strings if
Model.supportsEmptyStrings()
is false.- Author:
- Ralf Wiebicke
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MandatoryViolationException(Feature feature, Settable<?> settable, Item item)
Deprecated.Usecreate(Feature, Item)
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MandatoryViolationException
create(Feature feature, Item item)
Creates a new MandatoryViolationException with the necessary information about the violation.Feature
getFeature()
Returns the feature, that was attempted to be written.Feature
getMandatoryAttribute()
Deprecated.Renamed togetFeature()
.String
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 Detail
-
MandatoryViolationException
@Deprecated public MandatoryViolationException(Feature feature, Settable<?> settable, Item item)
Deprecated.Usecreate(Feature, Item)
instead.
-
-
Method Detail
-
requireNonNull
public static void requireNonNull(@Nonnull Object value, Feature feature, Item item)
-
create
public static MandatoryViolationException create(Feature feature, Item item)
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
public Feature getFeature()
Returns the feature, that was attempted to be written.- Specified by:
getFeature
in classConstraintViolationException
-
getMessage
public String getMessage(boolean withFeature)
- Specified by:
getMessage
in classConstraintViolationException
-
getMandatoryAttribute
@Deprecated public Feature getMandatoryAttribute()
Deprecated.Renamed togetFeature()
.
-
-