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 anullvalue.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.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.booleanshouldValidate(PolicyAttribute policyAttribute, IModelObject modelObject) Decides whether the givenPolicyAttributeshould be validated for the givenIModelObject.
-
Method Details
-
shouldValidate
Decides whether the givenPolicyAttributeshould be validated for the givenIModelObject.- 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
PolicyAttributeandIModelObjectshould run - 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.
-
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 anullvalue.- 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.- 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
-