use of io.atomix.utils.serializer.Namespace in project atomix by atomix.
the class AtomicDocumentTreeBuilder 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.getNodeType() != null) {
serializerBuilder.addType(config.getNodeType());
}
if (!config.getExtraTypes().isEmpty()) {
serializerBuilder.withTypes(config.getExtraTypes().toArray(new Class<?>[config.getExtraTypes().size()]));
}
serializer = serializerBuilder.build();
}
return serializer;
}
use of io.atomix.utils.serializer.Namespace in project atomix by atomix.
the class PrimitiveBuilder method serializer.
/**
* Returns the protocol serializer.
*
* @return the protocol serializer
*/
protected Serializer serializer() {
Serializer serializer = this.serializer;
if (serializer == null) {
synchronized (this) {
serializer = this.serializer;
if (serializer == null) {
NamespaceConfig config = this.config.getNamespaceConfig();
if (config == null) {
serializer = Serializer.using(Namespaces.BASIC);
} else {
serializer = Serializer.using(Namespace.builder().register(Namespaces.BASIC).nextId(Namespaces.BEGIN_USER_CUSTOM_ID).register(new Namespace(config)).build());
}
this.serializer = serializer;
}
}
}
return serializer;
}
Aggregations