Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 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 org.onosproject.store.service; |
| 17 | |
Jordan Halterman | 400bbe5 | 2018-04-05 23:07:47 -0700 | [diff] [blame] | 18 | import java.util.function.BiFunction; |
| 19 | |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 20 | import org.onosproject.store.primitives.DistributedPrimitiveOptions; |
| 21 | |
| 22 | /** |
| 23 | * Builder for constructing new AtomicValue instances. |
| 24 | * |
| 25 | * @param <V> atomic value type |
| 26 | */ |
| 27 | public abstract class AtomicValueOptions<O extends AtomicValueOptions<O, V>, V> extends DistributedPrimitiveOptions<O> { |
Jordan Halterman | 400bbe5 | 2018-04-05 23:07:47 -0700 | [diff] [blame] | 28 | protected BiFunction<V, org.onosproject.core.Version, V> compatibilityFunction; |
| 29 | |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 30 | public AtomicValueOptions() { |
| 31 | super(DistributedPrimitive.Type.VALUE); |
| 32 | } |
Jordan Halterman | 400bbe5 | 2018-04-05 23:07:47 -0700 | [diff] [blame] | 33 | |
| 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 Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 46 | } |