blob: 4639209472952dfb5fb6f3f5c6a69055f9fa1bc3 [file] [log] [blame]
Jian Lia0bf4592017-02-03 17:43:21 +09001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Jian Lia0bf4592017-02-03 17:43:21 +09003 *
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.mapping;
17
Jian Li44155b02017-02-15 17:03:38 +090018import org.onosproject.mapping.actions.MappingAction;
Jian Li136fd6c2017-02-10 14:54:59 +090019
20import java.util.List;
21
Jian Lia0bf4592017-02-03 17:43:21 +090022/**
23 * Abstraction of value of mapping information.
24 */
25public interface MappingValue {
Jian Li136fd6c2017-02-10 14:54:59 +090026
27 /**
Jian Li44155b02017-02-15 17:03:38 +090028 * Obtains a mapping action.
Jian Li136fd6c2017-02-10 14:54:59 +090029 *
Jian Li44155b02017-02-15 17:03:38 +090030 * @return a mapping action
Jian Li136fd6c2017-02-10 14:54:59 +090031 */
Jian Li44155b02017-02-15 17:03:38 +090032 MappingAction action();
Jian Li136fd6c2017-02-10 14:54:59 +090033
34 /**
35 * Obtains a collection of mapping instructions.
36 *
37 * @return a collection of mapping instructions
38 */
Jian Li44155b02017-02-15 17:03:38 +090039 List<MappingTreatment> treatments();
Jian Li136fd6c2017-02-10 14:54:59 +090040
41 interface Builder {
42
43 /**
Jian Li44155b02017-02-15 17:03:38 +090044 * Specifies a mapping action.
Jian Li136fd6c2017-02-10 14:54:59 +090045 *
Jian Li44155b02017-02-15 17:03:38 +090046 * @param action mapping action
Jian Li136fd6c2017-02-10 14:54:59 +090047 * @return a mapping value builder
48 */
Jian Li44155b02017-02-15 17:03:38 +090049 Builder withAction(MappingAction action);
Jian Li136fd6c2017-02-10 14:54:59 +090050
51 /**
Jian Li44155b02017-02-15 17:03:38 +090052 * Specifies a collection of mapping treatment.
Jian Li136fd6c2017-02-10 14:54:59 +090053 *
Jian Li44155b02017-02-15 17:03:38 +090054 * @param treatment a mapping treatment
Jian Li136fd6c2017-02-10 14:54:59 +090055 * @return a mapping value builder
56 */
Jian Li44155b02017-02-15 17:03:38 +090057 Builder add(MappingTreatment treatment);
Jian Li136fd6c2017-02-10 14:54:59 +090058
59 /**
60 * Builds an immutable mapping value.
61 *
62 * @return a mapping value
63 */
64 MappingValue build();
65 }
Jian Lia0bf4592017-02-03 17:43:21 +090066}