2 * Sone - ReceivedReplyEvent.java - Copyright © 2013 David Roden
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.
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.
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/>.
18 package net.pterodactylus.sone.freenet.plugin.event;
20 import net.pterodactylus.sone.freenet.plugin.PluginConnector;
21 import freenet.support.SimpleFieldSet;
22 import freenet.support.api.Bucket;
25 * Event that signals that a plugin reply was received.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29 public class ReceivedReplyEvent {
31 /** The connector that received the reply. */
32 private final PluginConnector pluginConnector;
34 /** The name of the plugin that sent the reply. */
35 private final String pluginName;
37 /** The identifier of the initial request. */
38 private final String identifier;
40 /** The fields containing the reply. */
41 private final SimpleFieldSet fieldSet;
43 /** The optional reply data. */
44 private final Bucket data;
47 * Creates a new “reply received” event.
49 * @param pluginConnector
50 * The connector that received the event
52 * The name of the plugin that sent the reply
54 * The identifier of the initial request
56 * The fields containing the reply
58 * The optional data of the reply
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;
73 * Returns the plugin connector that received the reply.
75 * @return The plugin connector that received the reply
77 public PluginConnector pluginConnector() {
78 return pluginConnector;
82 * Returns the name of the plugin that sent the reply.
84 * @return The name of the plugin that sent the reply
86 public String pluginName() {
91 * Returns the identifier of the initial request.
93 * @return The identifier of the initial request
95 public String identifier() {
100 * Returns the fields containing the reply.
102 * @return The fields containing the reply
104 public SimpleFieldSet fieldSet() {
109 * Returns the optional data of the reply.
111 * @return The optional data of the reply (may be {@code null})
113 public Bucket data() {