blob: ff7e988b9fb0c1c1b97b0185f3bd710943a5f93f [file] [log] [blame]
alshabibbc371962015-07-09 22:26:21 -07001/*
2 * Copyright 2015 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 */
alshabib1d2bc402015-07-31 17:04:11 -070016package org.onosproject.incubator.net.meter;
alshabibbc371962015-07-09 22:26:21 -070017
18import com.google.common.base.MoreObjects;
19
20/**
21 * Representation of an operation on the meter table.
22 */
23public class MeterOperation {
24
25 /**
26 * Tyoe of meter operation.
27 */
28 public enum Type {
29 ADD,
30 REMOVE,
31 MODIFY
32 }
33
34 private final Meter meter;
35 private final Type type;
36
37
38 public MeterOperation(Meter meter, Type type) {
39 this.meter = meter;
40 this.type = type;
41 }
42
43 /**
44 * Returns the type of operation.
45 *
46 * @return type
47 */
48 public Type type() {
49 return type;
50 }
51
52 /**
53 * Returns the meter.
54 *
55 * @return a meter
56 */
57 public Meter meter() {
58 return meter;
59 }
60
61 @Override
62 public String toString() {
63 return MoreObjects.toStringHelper(this)
64 .add("meter", meter)
65 .add("type", type)
66 .toString();
67 }
68}