java.lang.Object
es.kukenan.smartfi.common.service.validation.impl.hibernate.ErrorDetailDtoMapper

public class ErrorDetailDtoMapper extends Object
Javax constraint to ErrorDetailDto mapping utilities.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Set<es.kukenan.smartfi.common.api.dtos.error.ErrorDetailDto>
    map(Set<javax.validation.ConstraintViolation<T>> violations)
    Map a set of constraint violations to a list of ErrorDetailDto.
    private <T extends Annotation>
    String
    mapErrorCode(javax.validation.metadata.ConstraintDescriptor<T> violation)
    Retrieve the error code corresponding to the given violated constraint.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ErrorDetailDtoMapper

      public ErrorDetailDtoMapper()
  • Method Details

    • map

      public <T> Set<es.kukenan.smartfi.common.api.dtos.error.ErrorDetailDto> map(Set<javax.validation.ConstraintViolation<T>> violations)
      Map a set of constraint violations to a list of ErrorDetailDto.
      Type Parameters:
      T - the type of the root bean.
      Parameters:
      violations - the given constraint violations.
      Returns:
      the corresponding ErrorDetailDto list to the given ConstraintViolation set.
    • mapErrorCode

      private <T extends Annotation> String mapErrorCode(javax.validation.metadata.ConstraintDescriptor<T> violation)
      Retrieve the error code corresponding to the given violated constraint.
      Type Parameters:
      T - the constraint class.
      Parameters:
      violation - the viaolated constraint descriptor.
      Returns:
      the error code for the given constraint.