486d8079958e2ba295a6178fbc23918488a6dd7d
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / streams / listeners / Event.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.sal.streams.listeners;
9
10 import io.netty.channel.Channel;
11
12 /**
13  * Represents event of specific {@link EventType} type, holds data and
14  * {@link Channel} subscriber.
15  */
16 class Event {
17     private final EventType type;
18     private Channel subscriber;
19     private String data;
20
21     /**
22      * Creates new event specified by {@link EventType} type.
23      *
24      * @param type
25      *            EventType
26      */
27     Event(final EventType type) {
28         this.type = type;
29     }
30
31     /**
32      * Gets the {@link Channel} subscriber.
33      *
34      * @return Channel
35      */
36     public Channel getSubscriber() {
37         return this.subscriber;
38     }
39
40     /**
41      * Sets subscriber for event.
42      *
43      * @param subscriber
44      *            Channel
45      */
46     public void setSubscriber(final Channel subscriber) {
47         this.subscriber = subscriber;
48     }
49
50     /**
51      * Gets event String.
52      *
53      * @return String representation of event data.
54      */
55     public String getData() {
56         return this.data;
57     }
58
59     /**
60      * Sets event data.
61      *
62      * @param data
63      *            String.
64      */
65     public void setData(final String data) {
66         this.data = data;
67     }
68
69     /**
70      * Gets event type.
71      *
72      * @return The type of the event.
73      */
74     public EventType getType() {
75         return this.type;
76     }
77 }