Search in sources :

Example 1 with Namespace

use of io.atomix.utils.serializer.Namespace in project atomix by atomix.

the class DistributedCollectionBuilder method serializer.

/**
 * Returns the protocol serializer.
 *
 * @return the protocol serializer
 */
protected Serializer serializer() {
    if (serializer == null) {
        NamespaceConfig namespaceConfig = this.config.getNamespaceConfig();
        if (namespaceConfig == null) {
            namespaceConfig = new NamespaceConfig();
        }
        SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
        serializerBuilder.withNamespace(new Namespace(namespaceConfig));
        if (config.isRegistrationRequired()) {
            serializerBuilder.withRegistrationRequired();
        }
        if (config.isCompatibleSerialization()) {
            serializerBuilder.withCompatibleSerialization();
        }
        if (config.getElementType() != null) {
            serializerBuilder.addType(config.getElementType());
        }
        if (!config.getExtraTypes().isEmpty()) {
            serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
        }
        serializer = serializerBuilder.build();
    }
    return serializer;
}
Also used : NamespaceConfig(io.atomix.utils.serializer.NamespaceConfig) SerializerBuilder(io.atomix.utils.serializer.SerializerBuilder) Namespace(io.atomix.utils.serializer.Namespace)

Example 2 with Namespace

use of io.atomix.utils.serializer.Namespace in project atomix by atomix.

the class MapBuilder method serializer.

/**
 * Returns the protocol serializer.
 *
 * @return the protocol serializer
 */
protected Serializer serializer() {
    if (serializer == null) {
        NamespaceConfig namespaceConfig = this.config.getNamespaceConfig();
        if (namespaceConfig == null) {
            namespaceConfig = new NamespaceConfig();
        }
        SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
        serializerBuilder.withNamespace(new Namespace(namespaceConfig));
        if (config.isRegistrationRequired()) {
            serializerBuilder.withRegistrationRequired();
        }
        if (config.isCompatibleSerialization()) {
            serializerBuilder.withCompatibleSerialization();
        }
        if (config.getKeyType() != null) {
            serializerBuilder.addType(config.getKeyType());
        }
        if (config.getValueType() != null) {
            serializerBuilder.addType(config.getValueType());
        }
        if (!config.getExtraTypes().isEmpty()) {
            serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
        }
        serializer = serializerBuilder.build();
    }
    return serializer;
}
Also used : NamespaceConfig(io.atomix.utils.serializer.NamespaceConfig) SerializerBuilder(io.atomix.utils.serializer.SerializerBuilder) Namespace(io.atomix.utils.serializer.Namespace)

Example 3 with Namespace

use of io.atomix.utils.serializer.Namespace in project atomix by atomix.

the class MultimapBuilder method serializer.

/**
 * Returns the protocol serializer.
 *
 * @return the protocol serializer
 */
protected Serializer serializer() {
    if (serializer == null) {
        NamespaceConfig namespaceConfig = this.config.getNamespaceConfig();
        if (namespaceConfig == null) {
            namespaceConfig = new NamespaceConfig();
        }
        SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
        serializerBuilder.withNamespace(new Namespace(namespaceConfig));
        if (config.isRegistrationRequired()) {
            serializerBuilder.withRegistrationRequired();
        }
        if (config.isCompatibleSerialization()) {
            serializerBuilder.withCompatibleSerialization();
        }
        if (config.getKeyType() != null) {
            serializerBuilder.addType(config.getKeyType());
        }
        if (config.getValueType() != null) {
            serializerBuilder.addType(config.getValueType());
        }
        if (!config.getExtraTypes().isEmpty()) {
            serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
        }
        serializer = serializerBuilder.build();
    }
    return serializer;
}
Also used : NamespaceConfig(io.atomix.utils.serializer.NamespaceConfig) SerializerBuilder(io.atomix.utils.serializer.SerializerBuilder) Namespace(io.atomix.utils.serializer.Namespace)

Example 4 with Namespace

use of io.atomix.utils.serializer.Namespace in project atomix by atomix.

the class AtomicCounterMapBuilder method serializer.

/**
 * Returns the protocol serializer.
 *
 * @return the protocol serializer
 */
protected Serializer serializer() {
    if (serializer == null) {
        NamespaceConfig namespaceConfig = this.config.getNamespaceConfig();
        if (namespaceConfig == null) {
            namespaceConfig = new NamespaceConfig();
        }
        SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
        serializerBuilder.withNamespace(new Namespace(namespaceConfig));
        if (config.isRegistrationRequired()) {
            serializerBuilder.withRegistrationRequired();
        }
        if (config.isCompatibleSerialization()) {
            serializerBuilder.withCompatibleSerialization();
        }
        if (config.getKeyType() != null) {
            serializerBuilder.addType(config.getKeyType());
        }
        if (!config.getExtraTypes().isEmpty()) {
            serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
        }
        serializer = serializerBuilder.build();
    }
    return serializer;
}
Also used : NamespaceConfig(io.atomix.utils.serializer.NamespaceConfig) SerializerBuilder(io.atomix.utils.serializer.SerializerBuilder) Namespace(io.atomix.utils.serializer.Namespace)

Example 5 with Namespace

use of io.atomix.utils.serializer.Namespace in project atomix by atomix.

the class ValueBuilder method serializer.

/**
 * Returns the protocol serializer.
 *
 * @return the protocol serializer
 */
protected Serializer serializer() {
    if (serializer == null) {
        NamespaceConfig namespaceConfig = this.config.getNamespaceConfig();
        if (namespaceConfig == null) {
            namespaceConfig = new NamespaceConfig();
        }
        SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
        serializerBuilder.withNamespace(new Namespace(namespaceConfig));
        if (config.isRegistrationRequired()) {
            serializerBuilder.withRegistrationRequired();
        }
        if (config.isCompatibleSerialization()) {
            serializerBuilder.withCompatibleSerialization();
        }
        if (config.getValueType() != null) {
            serializerBuilder.addType(config.getValueType());
        }
        if (!config.getExtraTypes().isEmpty()) {
            serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
        }
        serializer = serializerBuilder.build();
    }
    return serializer;
}
Also used : NamespaceConfig(io.atomix.utils.serializer.NamespaceConfig) SerializerBuilder(io.atomix.utils.serializer.SerializerBuilder) Namespace(io.atomix.utils.serializer.Namespace)

Aggregations

Namespace (io.atomix.utils.serializer.Namespace)7 NamespaceConfig (io.atomix.utils.serializer.NamespaceConfig)7 SerializerBuilder (io.atomix.utils.serializer.SerializerBuilder)6 Serializer (io.atomix.utils.serializer.Serializer)1