2 * Copyright 2018-present Open Networking Foundation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package io.atomix.utils.serializer;
18 import io.atomix.utils.config.Config;
20 import java.util.ArrayList;
21 import java.util.List;
24 * Namespace configuration.
26 public class NamespaceConfig implements Config {
27 private String name = Namespace.NO_NAME;
28 private boolean registrationRequired = true;
29 private boolean compatible = false;
30 private List<NamespaceTypeConfig> types = new ArrayList<>();
33 * Returns the serializer name.
35 * @return the serializer name
37 public String getName() {
42 * Sets the serializer name.
44 * @param name the serializer name
45 * @return the serializer configuration
47 public NamespaceConfig setName(String name) {
53 * Returns whether registration is required.
55 * @return whether registration is required
57 public boolean isRegistrationRequired() {
58 return registrationRequired;
62 * Sets whether registration is required.
64 * @param registrationRequired whether registration is required
65 * @return the serializer configuration
67 public NamespaceConfig setRegistrationRequired(boolean registrationRequired) {
68 this.registrationRequired = registrationRequired;
73 * Returns whether compatible serialization is enabled.
75 * @return whether compatible serialization is enabled
77 public boolean isCompatible() {
82 * Sets whether compatible serialization is enabled.
84 * @param compatible whether compatible serialization is enabled
85 * @return the serializer configuration
87 public NamespaceConfig setCompatible(boolean compatible) {
88 this.compatible = compatible;
93 * Returns the serializable types.
95 * @return the serializable types
97 public List<NamespaceTypeConfig> getTypes() {
102 * Sets the serializable types.
104 * @param types the serializable types
105 * @return the serializer configuration
107 public NamespaceConfig setTypes(List<NamespaceTypeConfig> types) {
113 * Adds a serializable type to the configuration.
115 * @param type the serializable type to add
116 * @return the serializer configuration
118 public NamespaceConfig addType(NamespaceTypeConfig type) {