Jian Li | a0bf459 | 2017-02-03 17:43:21 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present 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 | */ |
| 16 | package org.onosproject.mapping; |
| 17 | |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 18 | import org.onosproject.mapping.actions.MappingAction; |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 19 | |
| 20 | import java.util.List; |
| 21 | |
Jian Li | a0bf459 | 2017-02-03 17:43:21 +0900 | [diff] [blame] | 22 | /** |
| 23 | * Abstraction of value of mapping information. |
| 24 | */ |
| 25 | public interface MappingValue { |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 26 | |
| 27 | /** |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 28 | * Obtains a mapping action. |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 29 | * |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 30 | * @return a mapping action |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 31 | */ |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 32 | MappingAction action(); |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Obtains a collection of mapping instructions. |
| 36 | * |
| 37 | * @return a collection of mapping instructions |
| 38 | */ |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 39 | List<MappingTreatment> treatments(); |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 40 | |
| 41 | interface Builder { |
| 42 | |
| 43 | /** |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 44 | * Specifies a mapping action. |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 45 | * |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 46 | * @param action mapping action |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 47 | * @return a mapping value builder |
| 48 | */ |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 49 | Builder withAction(MappingAction action); |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 50 | |
| 51 | /** |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 52 | * Specifies a collection of mapping treatment. |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 53 | * |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 54 | * @param treatment a mapping treatment |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 55 | * @return a mapping value builder |
| 56 | */ |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 57 | Builder add(MappingTreatment treatment); |
Jian Li | 136fd6c | 2017-02-10 14:54:59 +0900 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Builds an immutable mapping value. |
| 61 | * |
| 62 | * @return a mapping value |
| 63 | */ |
| 64 | MappingValue build(); |
| 65 | } |
Jian Li | a0bf459 | 2017-02-03 17:43:21 +0900 | [diff] [blame] | 66 | } |