Remove atomix.utils.Serializer(Builder) 22/104722/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:15:54 +0000 (14:15 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:16:45 +0000 (14:16 +0100)
These classes are completely unused and cause confusion with Kryo
interfaces. Remove them to improve clarity.

JIRA: CONTROLLER-2072
Change-Id: Ib4be23d08c1264a9d833d42958311bc24a2fee25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Serializer.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/DefaultSerializers.java [deleted file]

diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Serializer.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Serializer.java
deleted file mode 100644 (file)
index ec3aa6f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.atomix.utils.serializer;
-
-/**
- * Interface for serialization of store artifacts.
- */
-public interface Serializer {
-
-  /**
-   * Creates a new serializer builder.
-   *
-   * @return a new serializer builder
-   */
-  static SerializerBuilder builder() {
-    return new SerializerBuilder();
-  }
-
-  /**
-   * Creates a new serializer builder.
-   *
-   * @param name the serializer name
-   * @return a new serializer builder
-   */
-  static SerializerBuilder builder(String name) {
-    return new SerializerBuilder(name);
-  }
-
-  /**
-   * Serialize the specified object.
-   *
-   * @param object object to serialize.
-   * @param <T>    encoded type
-   * @return serialized bytes.
-   */
-  <T> byte[] encode(T object);
-
-  /**
-   * Deserialize the specified bytes.
-   *
-   * @param bytes byte array to deserialize.
-   * @param <T>   decoded type
-   * @return deserialized object.
-   */
-  <T> T decode(byte[] bytes);
-
-  /**
-   * Creates a new Serializer instance from a Namespace.
-   *
-   * @param namespace serializer namespace
-   * @return Serializer instance
-   */
-  static Serializer using(Namespace namespace) {
-    return new Serializer() {
-      @Override
-      public <T> byte[] encode(T object) {
-        return namespace.serialize(object);
-      }
-
-      @Override
-      public <T> T decode(byte[] bytes) {
-        return namespace.deserialize(bytes);
-      }
-    };
-  }
-
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java
deleted file mode 100644 (file)
index 074446b..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2018-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.atomix.utils.serializer;
-
-/**
- * Serializer builder.
- */
-public class SerializerBuilder {
-  private final String name;
-  private final Namespace.Builder namespaceBuilder = Namespace.builder()
-      .register(Namespaces.BASIC)
-      .nextId(Namespaces.BEGIN_USER_CUSTOM_ID);
-
-  public SerializerBuilder() {
-    this(null);
-  }
-
-  public SerializerBuilder(String name) {
-    this.name = name;
-  }
-
-  /**
-   * Requires explicit serializable type registration for serializable types.
-   *
-   * @return the serializer builder
-   */
-  public SerializerBuilder withRegistrationRequired() {
-    return withRegistrationRequired(true);
-  }
-
-  /**
-   * Sets whether serializable type registration is required for serializable types.
-   *
-   * @param registrationRequired whether serializable type registration is required for serializable types
-   * @return the serializer builder
-   */
-  public SerializerBuilder withRegistrationRequired(boolean registrationRequired) {
-    namespaceBuilder.setRegistrationRequired(registrationRequired);
-    return this;
-  }
-
-  /**
-   * Enables compatible serialization for serializable types.
-   *
-   * @return the serializer builder
-   */
-  public SerializerBuilder withCompatibleSerialization() {
-    return withCompatibleSerialization(true);
-  }
-
-  /**
-   * Sets whether compatible serialization is enabled for serializable types.
-   *
-   * @param compatibleSerialization whether compatible serialization is enabled for user types
-   * @return the serializer builder
-   */
-  public SerializerBuilder withCompatibleSerialization(boolean compatibleSerialization) {
-    namespaceBuilder.setCompatible(compatibleSerialization);
-    return this;
-  }
-
-  /**
-   * Adds a namespace to the serializer.
-   *
-   * @param namespace the namespace to add
-   * @return the serializer builder
-   */
-  public SerializerBuilder withNamespace(Namespace namespace) {
-    namespaceBuilder.register(namespace);
-    return this;
-  }
-
-  /**
-   * Sets the serializable types.
-   *
-   * @param types the types to register
-   * @return the serializer builder
-   */
-  public SerializerBuilder withTypes(Class<?>... types) {
-    namespaceBuilder.register(types);
-    return this;
-  }
-
-  /**
-   * Adds a serializable type to the builder.
-   *
-   * @param type the type to add
-   * @return the serializer builder
-   */
-  public SerializerBuilder addType(Class<?> type) {
-    namespaceBuilder.register(type);
-    return this;
-  }
-
-  /**
-   * Adds a serializer to the builder.
-   *
-   * @param serializer the serializer to add
-   * @param types the serializable types
-   * @return the serializer builder
-   */
-  public SerializerBuilder addSerializer(com.esotericsoftware.kryo.Serializer<?> serializer, Class<?>... types) {
-    namespaceBuilder.register(serializer, types);
-    return this;
-  }
-
-  /**
-   * Build the {@link Serializer}.
-   *
-   * @return A new {@link Serializer}.
-   */
-  public Serializer build() {
-    return Serializer.using(name != null ? namespaceBuilder.build(name) : namespaceBuilder.build());
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/DefaultSerializers.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/DefaultSerializers.java
deleted file mode 100644 (file)
index 849a67c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.atomix.utils.serializer.serializers;
-
-import io.atomix.utils.serializer.Serializer;
-
-/**
- * Default serializers.
- */
-public class DefaultSerializers {
-
-  /**
-   * Basic serializer.
-   */
-  public static final Serializer BASIC = Serializer.builder().build();
-
-  private DefaultSerializers() {
-  }
-}