blob: c1f04300ded187521e8c45062e0d809107710a54 [file] [log] [blame]
Jian Li93a13832016-02-09 11:21:47 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jian Li93a13832016-02-09 11:21:47 -08003 *
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
Jian Li93a13832016-02-09 11:21:47 -080018import org.onosproject.cpman.ControlMessage;
Jian Li72b9b122016-02-11 15:58:51 -080019import org.onosproject.event.AbstractEvent;
Jian Li93a13832016-02-09 11:21:47 -080020
Jian Li72b9b122016-02-11 15:58:51 -080021import java.util.Set;
Jian Li4545cf12016-02-10 11:06:06 -080022
Jian Li93a13832016-02-09 11:21:47 -080023import static com.google.common.base.MoreObjects.toStringHelper;
24
25/**
26 * Describes control message event.
27 */
28public class ControlMessageEvent
Jian Li72b9b122016-02-11 15:58:51 -080029 extends AbstractEvent<ControlMessageEvent.Type, Set<ControlMessage>> {
Jian Li93a13832016-02-09 11:21:47 -080030
31 /**
32 * Type of control message events.
33 */
34 public enum Type {
35 /**
36 * signifies that the control message stats has been updated.
37 */
38 STATS_UPDATE
39 }
40
41 /**
42 * Creates an event of given type and the current time.
43 *
Jian Li4545cf12016-02-10 11:06:06 -080044 * @param type control message event type
45 * @param controlMessages event control message subject
Jian Li93a13832016-02-09 11:21:47 -080046 */
Jian Li72b9b122016-02-11 15:58:51 -080047 public ControlMessageEvent(Type type, Set<ControlMessage> controlMessages) {
Jian Li4545cf12016-02-10 11:06:06 -080048 super(type, controlMessages);
Jian Li93a13832016-02-09 11:21:47 -080049 }
50
51 @Override
52 public String toString() {
53 return toStringHelper(this)
54 .add("type", type())
55 .add("subject", subject())
56 .toString();
57 }
58}