Remove another unnecessary class.
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / plugin / event / ReceivedReplyEvent.java
1 /*
2  * Sone - ReceivedReplyEvent.java - Copyright © 2013 David Roden
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 package net.pterodactylus.sone.freenet.plugin.event;
19
20 import net.pterodactylus.sone.freenet.plugin.PluginConnector;
21 import freenet.support.SimpleFieldSet;
22 import freenet.support.api.Bucket;
23
24 /**
25  * Event that signals that a plugin reply was received.
26  *
27  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28  */
29 public class ReceivedReplyEvent {
30
31         /** The connector that received the reply. */
32         private final PluginConnector pluginConnector;
33
34         /** The name of the plugin that sent the reply. */
35         private final String pluginName;
36
37         /** The identifier of the initial request. */
38         private final String identifier;
39
40         /** The fields containing the reply. */
41         private final SimpleFieldSet fieldSet;
42
43         /** The optional reply data. */
44         private final Bucket data;
45
46         /**
47          * Creates a new “reply received” event.
48          *
49          * @param pluginConnector
50          *            The connector that received the event
51          * @param pluginName
52          *            The name of the plugin that sent the reply
53          * @param identifier
54          *            The identifier of the initial request
55          * @param fieldSet
56          *            The fields containing the reply
57          * @param data
58          *            The optional data of the reply
59          */
60         public ReceivedReplyEvent(PluginConnector pluginConnector, String pluginName, String identifier, SimpleFieldSet fieldSet, Bucket data) {
61                 this.pluginConnector = pluginConnector;
62                 this.pluginName = pluginName;
63                 this.identifier = identifier;
64                 this.fieldSet = fieldSet;
65                 this.data = data;
66         }
67
68         //
69         // ACCESSORS
70         //
71
72         /**
73          * Returns the plugin connector that received the reply.
74          *
75          * @return The plugin connector that received the reply
76          */
77         public PluginConnector pluginConnector() {
78                 return pluginConnector;
79         }
80
81         /**
82          * Returns the name of the plugin that sent the reply.
83          *
84          * @return The name of the plugin that sent the reply
85          */
86         public String pluginName() {
87                 return pluginName;
88         }
89
90         /**
91          * Returns the identifier of the initial request.
92          *
93          * @return The identifier of the initial request
94          */
95         public String identifier() {
96                 return identifier;
97         }
98
99         /**
100          * Returns the fields containing the reply.
101          *
102          * @return The fields containing the reply
103          */
104         public SimpleFieldSet fieldSet() {
105                 return fieldSet;
106         }
107
108         /**
109          * Returns the optional data of the reply.
110          *
111          * @return The optional data of the reply (may be {@code null})
112          */
113         public Bucket data() {
114                 return data;
115         }
116
117 }