Package org.faktorips.runtime.validation
Interface IGenericAttributeValidationConfiguration
- All Known Implementing Classes:
DefaultGenericAttributeValidationConfiguration
public interface IGenericAttributeValidationConfiguration
Configuration for the generic validation of
PolicyAttribute
values. Provides specific
messages for common validation errors.-
Method Summary
Modifier and TypeMethodDescriptioncreateMessageForMissingMandatoryValue
(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is missing but the value set does not allow anull
value.createMessageForValueNotInAllowedValueSet
(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is not allowed by the value set.default Message
createMessageForValueNotInAllowedValueSet
(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass, org.faktorips.valueset.ValueSet<?> valueSet) Creates a message to indicate that the given attribute's value on the given model object is not allowed by the value set.createMessageForValuePresentForIrrelevantAttribute
(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is set but the value set does not allow a value.default <T> org.faktorips.valueset.ValueSet<T>
getValueSet
(PolicyAttribute policyAttribute, IModelObject modelObject) Returns the value set configured for the givenPolicyAttribute
on the givenIModelObject
.boolean
shouldValidate
(PolicyAttribute policyAttribute, IModelObject modelObject) Decides whether the givenPolicyAttribute
should be validated for the givenIModelObject
.
-
Method Details
-
shouldValidate
Decides whether the givenPolicyAttribute
should be validated for the givenIModelObject
.- Implementation Requirements:
- Implementers should use this to prevent validation of fields that can not yet be valid, for example because another field must first be set to derive their value set.
- Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute may be validated- Returns:
- whether validation for the given combination of
PolicyAttribute
andIModelObject
should run
-
createMessageForMissingMandatoryValue
Message createMessageForMissingMandatoryValue(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is missing but the value set does not allow anull
value.- Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute was validateddefiningModelObjectClass
- the model object class where the generic validation is defined
-
createMessageForValuePresentForIrrelevantAttribute
Message createMessageForValuePresentForIrrelevantAttribute(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is set but the value set does not allow a value.- Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute was validateddefiningModelObjectClass
- the model object class where the generic validation is defined
-
createMessageForValueNotInAllowedValueSet
Message createMessageForValueNotInAllowedValueSet(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass) Creates a message to indicate that the given attribute's value on the given model object is not allowed by the value set.- Implementation Requirements:
- You may implement
createMessageForValueNotInAllowedValueSet(PolicyAttribute, IModelObject, Class, ValueSet)
instead if you need to refer to the value set in your message. - Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute was validateddefiningModelObjectClass
- the model object class where the generic validation is defined
-
createMessageForValueNotInAllowedValueSet
default Message createMessageForValueNotInAllowedValueSet(PolicyAttribute policyAttribute, IModelObject modelObject, Class<? extends IModelObject> definingModelObjectClass, org.faktorips.valueset.ValueSet<?> valueSet) Creates a message to indicate that the given attribute's value on the given model object is not allowed by the value set.- Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute was validateddefiningModelObjectClass
- the model object class where the generic validation is definedvalueSet
- the actual value set, as retrieved bygetValueSet(PolicyAttribute, IModelObject)
and used in the validation- Since:
- 23.6
-
getValueSet
default <T> org.faktorips.valueset.ValueSet<T> getValueSet(PolicyAttribute policyAttribute, IModelObject modelObject) Returns the value set configured for the givenPolicyAttribute
on the givenIModelObject
.- Implementation Requirements:
- This method may be overwritten, for example for value conversions. It is called once at the beginning of validation, afterwards the returned value set is passed to all relevant methods.
- Type Parameters:
T
- the attribute's data type- Parameters:
policyAttribute
- the model type reference for the validated attributemodelObject
- the model object instance on which the attribute is validated- Since:
- 23.6
-