blob: cd2e060aa3088d325f682551d1020b7f3e111ae8 [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 /**
56 * Builds an set based on the configuration options
57 * supplied to this builder.
58 *
59 * @return new set
60 * @throws java.lang.RuntimeException if a mandatory parameter is missing
61 */
62 public Set<E> build();
63}