blob: b42e5f3e6ee8222eb8a3a1ac87ff7ee05a95631f [file] [log] [blame]
Jordan Halterman2c045992018-03-20 21:33:00 -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
Jordan Halterman400bbe52018-04-05 23:07:47 -070018import java.util.function.BiFunction;
19
Jordan Halterman2c045992018-03-20 21:33:00 -070020import org.onosproject.store.primitives.DistributedPrimitiveOptions;
21
22/**
23 * Builder for constructing new AtomicValue instances.
24 *
25 * @param <V> atomic value type
26 */
27public abstract class AtomicValueOptions<O extends AtomicValueOptions<O, V>, V> extends DistributedPrimitiveOptions<O> {
Jordan Halterman400bbe52018-04-05 23:07:47 -070028 protected BiFunction<V, org.onosproject.core.Version, V> compatibilityFunction;
29
Jordan Halterman2c045992018-03-20 21:33:00 -070030 public AtomicValueOptions() {
31 super(DistributedPrimitive.Type.VALUE);
32 }
Jordan Halterman400bbe52018-04-05 23:07:47 -070033
34 /**
35 * Sets a compatibility function on the map.
36 *
37 * @param compatibilityFunction the compatibility function
38 * @return the consistent map builder
39 */
40 @SuppressWarnings("unchecked")
41 public O withCompatibilityFunction(
42 BiFunction<V, org.onosproject.core.Version, V> compatibilityFunction) {
43 this.compatibilityFunction = compatibilityFunction;
44 return (O) this;
45 }
Jordan Halterman2c045992018-03-20 21:33:00 -070046}