blob: 3ea7aaf536927f69cee9ed20ff05fca0ae5481a9 [file] [log] [blame]
Madan Jampani08706ce2015-04-01 14:49:28 -07001/*
2 * Copyright 2015 Open Networking Laboratory
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 */
16package org.onosproject.store.service;
17
18import java.util.Set;
19
20/**
21 * Builder for distributed set.
22 *
23 * @param <E> type set elements.
24 */
25public interface SetBuilder<E> {
26
27 /**
28 * Sets the name of the set.
29 * <p>
30 * Each set is identified by a unique name.
31 * </p>
32 * <p>
33 * Note: This is a mandatory parameter.
34 * </p>
35 *
36 * @param name name of the set
37 * @return this SetBuilder
38 */
39 public SetBuilder<E> withName(String name);
40
41 /**
42 * Sets a serializer that can be used to serialize
43 * the elements add to the set. The serializer
44 * builder should be pre-populated with any classes that will be
45 * put into the set.
46 * <p>
47 * Note: This is a mandatory parameter.
48 * </p>
49 *
50 * @param serializer serializer
51 * @return this SetBuilder
52 */
53 public SetBuilder<E> withSerializer(Serializer serializer);
54
55 /**
Madan Jampani02b7fb82015-05-01 13:01:20 -070056 * Disables set updates.
57 * <p>
58 * Attempt to update the built set will throw {@code UnsupportedOperationException}.
59 *
60 * @return this SetBuilder
61 */
62 SetBuilder<E> withUpdatesDisabled();
63
64 /**
Madan Jampani08706ce2015-04-01 14:49:28 -070065 * Builds an set based on the configuration options
66 * supplied to this builder.
67 *
68 * @return new set
69 * @throws java.lang.RuntimeException if a mandatory parameter is missing
70 */
71 public Set<E> build();
72}