Class EntityValidatorManager

    • Constructor Detail

    • Method Detail

      • supports

        public boolean supports​(Class<?> clazz,
                                ContextInfo context)
        Description copied from interface: EntityValidator
        Whether or not this validator supports validating the given service class
        Specified by:
        supports in interface EntityValidator
        Parameters:
        clazz - the
        context - what context this validator is running in
        Returns:
        whether or not this validator should be executed
      • validate

        public void validate​(@NonNull
                             Object businessInstance,
                             @NonNull
                             org.springframework.validation.Errors errors,
                             ContextInfo context)
        Description copied from interface: EntityValidator

        Default validation that handles create, replace and update. This is invoked by default by each individual lifecycle method and is available as a simple override point for global validation that should apply to all contexts.

        Specified by:
        validate in interface EntityValidator
        Parameters:
        businessInstance - representation of the repositoryInstance
        errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the businessInstance
        context - current context this validation is running in
      • validateForCreate

        public void validateForCreate​(@NonNull
                                      Object businessInstance,
                                      @NonNull
                                      org.springframework.validation.Errors errors,
                                      ContextInfo context)
        Description copied from interface: EntityValidator
        Validate a new repositoryInstance being added based on its businessInstance representation
        Specified by:
        validateForCreate in interface EntityValidator
        Parameters:
        businessInstance - representation of the repositoryInstance being used to create
        errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the businessInstance
        context - current context this validation is running in
      • validateForUpdate

        public void validateForUpdate​(@NonNull
                                      Object updatedBusinessInstance,
                                      @NonNull
                                      org.springframework.validation.Errors errors,
                                      ContextInfo context)
        Description copied from interface: EntityValidator
        Validate an update to a repositoryInstance based upon the business representation of the result of applying the update.

        Note that this method validates updatedBusinessInstance, which is the businessInstance representation of the repositoryInstance after applying the requested changes (but before persisting them). updatedBusinessInstance is not an object that just contains the requested changes.

        Specified by:
        validateForUpdate in interface EntityValidator
        Parameters:
        updatedBusinessInstance - the business representation of the result of applying some updates to an existing repositoryInstance
        errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the updatedBusinessInstance
        context - current context this validation is running in
      • validateForReplace

        public void validateForReplace​(@NonNull
                                       Object businessInstance,
                                       @NonNull
                                       org.springframework.validation.Errors errors,
                                       ContextInfo context)
        Description copied from interface: EntityValidator
        Validate a replacement for the repositoryInstance. All fields in businessInstance are direct replacements for those in repositoryInstance
        Specified by:
        validateForReplace in interface EntityValidator
        Parameters:
        businessInstance - representation of the repositoryInstance being used as a replacement
        errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the businessInstance
        context - current context this validation is running in