Class BeanValidationStrategy

    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • attributeType

        private Class<?> attributeType
        expected return type of an attribute
    • Constructor Detail

      • BeanValidationStrategy

        public BeanValidationStrategy​(Class<?> attributeType)
        Constructor for the strategy
        Parameters:
        attributeType - expected return type of an attribute
    • Method Detail

      • findTypeFromList

        public static <T> T findTypeFromList​(List<?> list,
                                             Class<T> type)
        Utility to find an item of a desired type in the given list
        Type Parameters:
        T - Return type of item to find
        Parameters:
        list - List to search in
        type - Type to find in the list
        Returns:
        First element from the list of desired type
      • getValueInRange

        private BigDecimal getValueInRange​(BigDecimal min,
                                           BigDecimal max)
        Produces random decimal value within specified range
        Parameters:
        min - minimum value of range
        max - maximum value of range
        Returns:
        decimal value in the specified range
      • decimalToReturnType

        private Object decimalToReturnType​(BigDecimal result)
        Converts intermediate decimal value to the actual attribute type, for example, string representation of this decimal
        Parameters:
        result - BigDecimal intermediate result to convert to the real attribute type
        Returns:
        actual attribute type object
      • timestampToReturnType

        private Object timestampToReturnType​(Long result)
        Converts intermediate long time stamp value to the actual attribute type, Date or Calendar
        Parameters:
        result - Long intermediate result to convert to the real attribute type
        Returns:
        actual attribute type object