blob: 7845b56f2b95e46eef062d5a1b4b21126eb6b472 [file] [log] [blame]
Jordan Halterman400bbe52018-04-05 23:07:47 -07001/*
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 */
16package org.onosproject.store.service;
17
18import java.util.function.BiFunction;
19
20import org.onosproject.store.primitives.DistributedPrimitiveOptions;
21
22/**
23 * Builder for {@link Topic} instances.
24 *
25 * @param <T> type for topic value
26 */
27public abstract class TopicOptions<O extends TopicOptions<O, T>, T>
28 extends DistributedPrimitiveOptions<O> {
29
30 protected BiFunction<T, org.onosproject.core.Version, T> compatibilityFunction;
31
32 public TopicOptions() {
33 super(DistributedPrimitive.Type.TOPIC);
34 }
35
36 /**
37 * Sets a compatibility function on the map.
38 *
39 * @param compatibilityFunction the compatibility function
40 * @return the consistent map builder
41 */
42 @SuppressWarnings("unchecked")
43 public O withCompatibilityFunction(
44 BiFunction<T, org.onosproject.core.Version, T> compatibilityFunction) {
45 this.compatibilityFunction = compatibilityFunction;
46 return (O) this;
47 }
48
49}