Package org.faktorips.runtime.validation
Class GenericRelevanceValidation
- java.lang.Object
-
- org.faktorips.runtime.validation.GenericRelevanceValidation
-
public class GenericRelevanceValidation extends java.lang.ObjectClass for validating the attribute relevance and value range.- Since:
- 21.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGenericRelevanceValidation.Error
-
Constructor Summary
Constructors Constructor Description GenericRelevanceValidation(IModelObject modelObject, java.lang.Class<? extends IModelObject> definingModelObjectClass, PolicyAttribute policyAttribute, IGenericAttributeValidationConfiguration config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MessageListof(IModelObject modelObject, java.lang.Class<? extends IModelObject> definingModelObjectClass, java.lang.String propertyName, IValidationContext validationContext)Creates aGenericRelevanceValidationfor the given model object's attribute using the validation context togettheIGenericAttributeValidationConfigurationandvalidatesthe attribute.MessageListvalidate()Checks the attribute for the following violations: Mandatory violation: The attribute is aRelevance.MANDATORYfield and the value is missing.
-
-
-
Constructor Detail
-
GenericRelevanceValidation
public GenericRelevanceValidation(IModelObject modelObject, java.lang.Class<? extends IModelObject> definingModelObjectClass, PolicyAttribute policyAttribute, IGenericAttributeValidationConfiguration config)
-
-
Method Detail
-
of
public static MessageList of(IModelObject modelObject, java.lang.Class<? extends IModelObject> definingModelObjectClass, java.lang.String propertyName, IValidationContext validationContext)
Creates aGenericRelevanceValidationfor the given model object's attribute using the validation context togettheIGenericAttributeValidationConfigurationandvalidatesthe attribute.- Parameters:
modelObject- the model object to validatepropertyName- the name of aPolicyAttributeof the model objectvalidationContext- the context containing information on what to validate and how to create error messages- Returns:
- the messages resulting from the validation, if any, or an empty message list if
validation was successful (or not performed because of
IGenericAttributeValidationConfiguration.shouldValidate(PolicyAttribute, IModelObject)returningfalse
-
validate
public MessageList validate()
Checks the attribute for the following violations:- Mandatory violation: The attribute is a
Relevance.MANDATORYfield and the value is missing. - Irrelevant violation: The value set is empty(
Relevance.IRRELEVANT), so the attribute cannot have a value. - Value set violation: The attribute contains a value that is not part of the value set.
- Returns:
- A MessageList with the validation results
- Mandatory violation: The attribute is a
-
-