All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.mappers.MessagePackObjectMapper Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.mappers;

import org.msgpack.value.Value;

/**
 * Basic interface for generic converters between Java objects and MessagePack entities.
 * Object converters must be added using the {@link #registerObjectConverter(Class, Class, ObjectConverter)} method
 *
 * @author Alexey Kuzin
 */
public interface MessagePackObjectMapper {
    /**
     * Create MessagePack entity representation for an object.
     * @param o an object to be converted
     * @param  the target MessagePack entity type
     * @param  the source object type
     * @throws MessagePackObjectMapperException if the corresponding conversion cannot be performed
     * @return instance of MessagePack {@link Value}
     */
     V toValue(O o) throws MessagePackObjectMapperException;

    /**
     * Adds a Java object converter to this mappers instance
     * @param objectClass source object class
     * @param valueClass target value class
     * @param converter entity-to-object converter
     * @param  the target MessagePack entity type
     * @param  the source object type
     * @see ObjectConverter
     */
     void registerObjectConverter(Class objectClass, Class valueClass,
                                                      ObjectConverter converter);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy