java.lang.Object
org.apache.johnzon.mapper.converter.ClassConverter
- All Implemented Interfaces:
Converter<Class<?>>,MapperConverter
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.johnzon.mapper.Converter
Converter.TypeAccess -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Collection<String>private final Collection<String> -
Constructor Summary
ConstructorsConstructorDescriptionSerialization only, any incoming class name is rejected.ClassConverter(Collection<String> allowedClasses, Collection<String> allowedPrefixes) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Collection<String>copy(Collection<String> values) Class<?>fromString(String text) private boolean
-
Field Details
-
allowedClasses
-
allowedPrefixes
-
-
Constructor Details
-
ClassConverter
public ClassConverter()Serialization only, any incoming class name is rejected. -
ClassConverter
- 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.
-
-
Method Details