Class VariantMapper

    • Method Detail

      • mapVariant

        public static <T> T mapVariant​(Variant variant,
                                       Class<T> clazz)
        Maps the provided Variant to an instance of the provided class.
        Type Parameters:
        T - type of the provided class
        Parameters:
        variant - variant to map
        clazz - class to which the variant will be mapped
        Returns:
        an object of a given class, created by mapping the variant
        Throws:
        VariantMapperException - if the provided variant can not be mapped to an instance of the provided class
      • mapVariant

        public static <T> T mapVariant​(Variant variant,
                                       JavaType clazz)
        Maps the provided Variant to an instance of the provided JavaType.
        Type Parameters:
        T - type of the provided class
        Parameters:
        variant - variant to map
        clazz - class to which the variant will be mapped
        Returns:
        an object of a given class, created by mapping the variant
        Throws:
        VariantMapperException - if the provided variant can not be mapped to an instance of the provided class
      • mapToVariant

        public static <T> Variant mapToVariant​(T value)
        Maps the provided value to Variant.
        Type Parameters:
        T - type of the provided value
        Parameters:
        value - value to map
        Returns:
        Variant created from the provided value
        Throws:
        VariantMapperException - if the provided value can not be mapped to Variant