Class DefaultGenericAttributeValidationConfiguration

    • Field Detail

      • ERROR_MANDATORY_MSG_CODE_PREFIX

        public static final java.lang.String ERROR_MANDATORY_MSG_CODE_PREFIX
        Message code prefix indicating a missing value for a mandatory attribute.
        See Also:
        Constant Field Values
      • ERROR_IRRELEVANT_MSG_CODE_PREFIX

        public static final java.lang.String ERROR_IRRELEVANT_MSG_CODE_PREFIX
        Message code prefix indicating a value is set for an irrelevant attribute.
        See Also:
        Constant Field Values
      • ERROR_INVALID_MSG_CODE_PREFIX

        public static final java.lang.String ERROR_INVALID_MSG_CODE_PREFIX
        Message code prefix indicating a missing value outside of an attribute's allowed value set.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultGenericAttributeValidationConfiguration

        public DefaultGenericAttributeValidationConfiguration​(java.util.Locale locale)
      • DefaultGenericAttributeValidationConfiguration

        public DefaultGenericAttributeValidationConfiguration​(java.util.ResourceBundle messages,
                                                              java.util.Locale locale)
    • Method Detail

      • getLocale

        public java.util.Locale getLocale()
        Returns the Locale this configuration was created for.
      • getMessages

        public java.util.ResourceBundle getMessages()
        Returns the ResourceBundle for this configuration.
      • createMsgCode

        protected java.lang.String createMsgCode​(java.lang.String msgCodePrefix,
                                                 IModelObject modelObject,
                                                 PolicyAttribute policyAttribute)
        Creates a message code from the pattern <prefix>.<policyCmptTypeName>.<policyAttributeName>.
      • format

        protected java.lang.String format​(java.lang.String msgKey,
                                          java.lang.Object... replacementParameters)
        Formats the String obtained from this configuration's ResourceBundle with the given key using the replacement parameters.
        Parameters:
        msgKey - the key to find the format String from the ResourceBundle.
        replacementParameters - the parameters to be passed to String.format(String, Object...)
      • getLabelFor

        protected java.lang.String getLabelFor​(PolicyAttribute policyAttribute,
                                               IModelObject modelObject)
        Returns the label for the given attribute to be used in an error message.
        Parameters:
        policyAttribute - the model type reference for the validated attribute
        modelObject - the model object instance on which the attribute was validated
        Implementation Requirements:
        Implementers may use the given model object to further qualify the field.
        Implementation Note:
        The default implementation uses the attribute's label in the locale provided to this configuration's constructor and returns it in double quotes.