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 Details

    • shouldValidate

      boolean shouldValidate(PolicyAttribute policyAttribute, IModelObject modelObject)
      Decides whether the given PolicyAttribute should be validated for the given IModelObject.
      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 attribute
      modelObject - the model object instance on which the attribute may be validated
      Returns:
      whether validation for the given combination of PolicyAttribute and IModelObject 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 a null value.
      Parameters:
      policyAttribute - the model type reference for the validated attribute
      modelObject - the model object instance on which the attribute was validated
      definingModelObjectClass - 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 attribute
      modelObject - the model object instance on which the attribute was validated
      definingModelObjectClass - 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 attribute
      modelObject - the model object instance on which the attribute was validated
      definingModelObjectClass - 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 attribute
      modelObject - the model object instance on which the attribute was validated
      definingModelObjectClass - the model object class where the generic validation is defined
      valueSet - the actual value set, as retrieved by getValueSet(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 given PolicyAttribute on the given IModelObject.
      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 attribute
      modelObject - the model object instance on which the attribute is validated
      Since:
      23.6