Class ClassConverter

  • All Implemented Interfaces:
    Converter<Class<?>>, MapperConverter

    public class ClassConverter
    extends Object
    implements Converter<Class<?>>
    Maps a Class to/from its name.

    Deserializing a class name means loading the class the incoming document asks for, so this converter is not registered by default and must be registered explicitly - see MapperBuilder#addConverter - with the set of classes it is allowed to load. Both allow-lists default to empty, ie deserialization always fails until they are configured.

    • Constructor Detail

      • ClassConverter

        public ClassConverter()
        Serialization only, any incoming class name is rejected.
      • ClassConverter

        public ClassConverter​(Collection<String> allowedClasses,
                              Collection<String> allowedPrefixes)
        Parameters:
        allowedClasses - the fully qualified names which can be loaded from the incoming document.
        allowedPrefixes - the prefixes - generally packages - a class name must start with to be loaded.