Class CoercionHelper


  • public class CoercionHelper
    extends Object
    Helper for converting values
    • Constructor Detail

      • CoercionHelper

        public CoercionHelper()
    • Method Detail

      • coerceList

        public static <T> List<T> coerceList​(Class<T> elementType,
                                             Object value)
        Coerces a value collection to a list of the given type
      • coerceMap

        public static <K,​V> Map<K,​V> coerceMap​(Class<K> keyType,
                                                           Class<V> valueType,
                                                           Object value)
        Coerces a value Map to a list of the given type
      • coercePage

        public static <T> Page<T> coercePage​(Class<T> elementType,
                                             Object object)
        Converts the given object into a Page
      • coerceSet

        public static <T> Set<T> coerceSet​(Class<T> elementType,
                                           Object value)
        Coerces a value collection to a set of the given type
      • isCollection

        public static boolean isCollection​(String name)
        Returns whether the given class name represents a generic collection
      • isList

        public static boolean isList​(String name)
        Returns whether the given class name represents a List
      • isSet

        public static boolean isSet​(String name)
        Returns whether the given class name represents a Set
      • toIterator

        public static Iterator<?> toIterator​(Object value)
        Returns an iterator for the given value
      • understands

        public static boolean understands​(Class<?> type)
        Checks whether the given type have a registered coercer
      • wrapperClass

        public static Class<?> wrapperClass​(Class<?> primitiveClass)
        Returns the wrapper class of a given primitive class, or null if not a primitive class