Remove most of atomix.utils.*
[controller.git] / third-party / atomix / utils / src / main / java / io / atomix / utils / serializer / NamespaceConfig.java
1 /*
2  * Copyright 2018-present Open Networking Foundation
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package io.atomix.utils.serializer;
17
18 import io.atomix.utils.config.Config;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23 /**
24  * Namespace configuration.
25  */
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<>();
31
32   /**
33    * Returns the serializer name.
34    *
35    * @return the serializer name
36    */
37   public String getName() {
38     return name;
39   }
40
41   /**
42    * Sets the serializer name.
43    *
44    * @param name the serializer name
45    * @return the serializer configuration
46    */
47   public NamespaceConfig setName(String name) {
48     this.name = name;
49     return this;
50   }
51
52   /**
53    * Returns whether registration is required.
54    *
55    * @return whether registration is required
56    */
57   public boolean isRegistrationRequired() {
58     return registrationRequired;
59   }
60
61   /**
62    * Sets whether registration is required.
63    *
64    * @param registrationRequired whether registration is required
65    * @return the serializer configuration
66    */
67   public NamespaceConfig setRegistrationRequired(boolean registrationRequired) {
68     this.registrationRequired = registrationRequired;
69     return this;
70   }
71
72   /**
73    * Returns whether compatible serialization is enabled.
74    *
75    * @return whether compatible serialization is enabled
76    */
77   public boolean isCompatible() {
78     return compatible;
79   }
80
81   /**
82    * Sets whether compatible serialization is enabled.
83    *
84    * @param compatible whether compatible serialization is enabled
85    * @return the serializer configuration
86    */
87   public NamespaceConfig setCompatible(boolean compatible) {
88     this.compatible = compatible;
89     return this;
90   }
91
92   /**
93    * Returns the serializable types.
94    *
95    * @return the serializable types
96    */
97   public List<NamespaceTypeConfig> getTypes() {
98     return types;
99   }
100
101   /**
102    * Sets the serializable types.
103    *
104    * @param types the serializable types
105    * @return the serializer configuration
106    */
107   public NamespaceConfig setTypes(List<NamespaceTypeConfig> types) {
108     this.types = types;
109     return this;
110   }
111
112   /**
113    * Adds a serializable type to the configuration.
114    *
115    * @param type the serializable type to add
116    * @return the serializer configuration
117    */
118   public NamespaceConfig addType(NamespaceTypeConfig type) {
119     types.add(type);
120     return this;
121   }
122 }