public interface ModelMapperSerializer
ModelMapper
instances using Kryo
.Modifier and Type | Method and Description |
---|---|
org.modelmapper.ModelMapper |
deserialize(com.esotericsoftware.kryo.kryo5.Kryo kryo,
byte[] serialized)
Given a byte array representation of a
ModelMapper instance, deserialize into a
concrete instance using Kryo . |
void |
generateCacheResources(Class<?>[] entities)
A rich lifecycle method, calls will generate
ModelMapper instances for the specified
entities, serialize those ModelMappers, and persist those mappers to disk in a file entitled
mappers.zip . |
String |
hash(Class<?> entity)
Create a hash uniquely identifying the class structure, including fields and types in the
object graph.
|
void |
loadCacheResources(Class<?>[] entities)
A rich lifecycle method, calls will read
ModelMapper serialized files from
mappers.zip for the specified entities, deserialize those ModelMappers, and inject
those mappers into cache upon application startup. |
byte[] |
serialize(com.esotericsoftware.kryo.kryo5.Kryo kryo,
org.modelmapper.ModelMapper mapper)
Serialize the
ModelMapper instance to a byte array - presumably to save to a file. |
com.esotericsoftware.kryo.kryo5.Kryo |
setup(Class<?>[] entities)
Create a
Kryo instance and perform the initial setup. |
com.esotericsoftware.kryo.kryo5.Kryo setup(Class<?>[] entities)
Kryo
instance and perform the initial setup. See KryoCustomizer
.entities
- The list of entities registered in the ORM.Kryo
instance.byte[] serialize(com.esotericsoftware.kryo.kryo5.Kryo kryo, org.modelmapper.ModelMapper mapper)
ModelMapper
instance to a byte array - presumably to save to a file.kryo
- The Kryo
instance to use for serializationmapper
- The ModelMapper
instance to serializeorg.modelmapper.ModelMapper deserialize(com.esotericsoftware.kryo.kryo5.Kryo kryo, byte[] serialized)
ModelMapper
instance, deserialize into a
concrete instance using Kryo
.kryo
- The Kryo
instance to use for deserializationserialized
- The serialized model mapperString hash(Class<?> entity)
entity
- The entity class to evaluatevoid generateCacheResources(Class<?>[] entities)
ModelMapper
instances for the specified
entities, serialize those ModelMappers, and persist those mappers to disk in a file entitled
mappers.zip
. The file is usually saved in the current application's source under the
maven resources/cache directory structure. See ResourceProvider
, and concrete
implementations, for where and how the mappers.zip file is stored.
A file called
classes.zip
is also created in the same location to hold any additional
required classes that are needed to successfully deserialize the ModelMapper instances. These
classes are generally injected into the target classloader upon deserialization (see
loadCacheResources(Class[])
).entities
- The entities from which to derive ModelMapper instances for serializationvoid loadCacheResources(Class<?>[] entities)
ModelMapper
serialized files from
mappers.zip
for the specified entities, deserialize those ModelMappers, and inject
those mappers into cache upon application startup. classes.zip
is also consulted and
classes discovered there are injected into the current classloader prior to attempting
deserialization. See generateCacheResources(Class[])
for information on how
mappers.zip and classes.zip originate.entities
- The entities from which to deserialize ModelMapper instances and populate
cacheCopyright © 2021. All rights reserved.