blob: b2412b7bd5d1f6f91d455ea808e325454c530aab [file] [log] [blame]
Jian Li93a13832016-02-09 11:21:47 -08001/*
2 * Copyright 2016 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 */
16package org.onosproject.cpman.message;
17
18import org.onosproject.event.AbstractEvent;
19import org.onosproject.cpman.ControlMessage;
20
21import static com.google.common.base.MoreObjects.toStringHelper;
22
23/**
24 * Describes control message event.
25 */
26public class ControlMessageEvent
27 extends AbstractEvent<ControlMessageEvent.Type, ControlMessage> {
28
29 /**
30 * Type of control message events.
31 */
32 public enum Type {
33 /**
34 * signifies that the control message stats has been updated.
35 */
36 STATS_UPDATE
37 }
38
39 /**
40 * Creates an event of given type and the current time.
41 *
42 * @param type control message event type
43 * @param controlMessage event control message subject
44 */
45 public ControlMessageEvent(Type type, ControlMessage controlMessage) {
46 super(type, controlMessage);
47 }
48
49 @Override
50 public String toString() {
51 return toStringHelper(this)
52 .add("type", type())
53 .add("subject", subject())
54 .toString();
55 }
56}