Class SerTypeMapper


  • public final class SerTypeMapper
    extends Object
    Type mapper for Joda-Bean serialization, used by serialization implementations.
    • Method Detail

      • encodeType

        public static String encodeType​(Class<?> cls,
                                        JodaBeanSer settings,
                                        String basePackage,
                                        Map<Class<?>,​String> knownTypes)
        Encodes a basic class.

        This handles known simple types, like String, Integer or File, and prefixing. It also allows a map of message specific shorter forms.

        Parameters:
        cls - the class to encode, not null
        settings - the settings object, not null
        basePackage - the base package to use with trailing dot, null if none
        knownTypes - the known types map, null if not using known type shortening
        Returns:
        the class object, null if not a basic type
      • decodeType

        public static Class<?> decodeType​(String className,
                                          JodaBeanSer settings,
                                          String basePackage,
                                          Map<String,​Class<?>> knownTypes)
                                   throws ClassNotFoundException
        Decodes a class, throwing an exception if not found.

        This uses the context class loader. This handles known simple types, like String, Integer or File, and prefixing. It also allows a map of message specific shorter forms.

        Parameters:
        className - the class name, not null
        settings - the settings object, not null
        basePackage - the base package to use with trailing dot, null if none
        knownTypes - the known types map, null if not using known type shortening
        Returns:
        the class object, not null
        Throws:
        ClassNotFoundException - if not found
      • decodeType

        public static Class<?> decodeType​(String className,
                                          JodaBeanSer settings,
                                          String basePackage,
                                          Map<String,​Class<?>> knownTypes,
                                          Class<?> defaultType)
                                   throws ClassNotFoundException
        Decodes a class, returning a default if not found.

        This uses the context class loader. This handles known simple types, like String, Integer or File, and prefixing. It also allows a map of message specific shorter forms.

        Parameters:
        className - the class name, not null
        settings - the settings object, not null
        basePackage - the base package to use with trailing dot, null if none
        knownTypes - the known types map, null if not using known type shortening
        defaultType - the type to use as a default if the type cannot be found
        Returns:
        the class object, not null
        Throws:
        ClassNotFoundException - if an error occurs