2 * fplugin - ReceivedReplyEvent.java - Copyright © 2013–2015 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.freenet.plugin.event;
20 import net.pterodactylus.freenet.plugin.PluginConnector;
22 import freenet.support.SimpleFieldSet;
23 import freenet.support.api.Bucket;
26 * Event that signals that a plugin reply was received.
28 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30 public class ReceivedReplyEvent {
32 /** The connector that received the reply. */
33 private final PluginConnector pluginConnector;
35 /** The name of the plugin that sent the reply. */
36 private final String pluginName;
38 /** The identifier of the initial request. */
39 private final String identifier;
41 /** The fields containing the reply. */
42 private final SimpleFieldSet fieldSet;
44 /** The optional reply data. */
45 private final Bucket data;
48 * Creates a new “reply received” event.
50 * @param pluginConnector
51 * The connector that received the event
53 * The name of the plugin that sent the reply
55 * The identifier of the initial request
57 * The fields containing the reply
59 * The optional data of the reply
61 public ReceivedReplyEvent(PluginConnector pluginConnector, String pluginName, String identifier,
62 SimpleFieldSet fieldSet, Bucket data) {
63 this.pluginConnector = pluginConnector;
64 this.pluginName = pluginName;
65 this.identifier = identifier;
66 this.fieldSet = fieldSet;
75 * Returns the plugin connector that received the reply.
77 * @return The plugin connector that received the reply
79 public PluginConnector pluginConnector() {
80 return pluginConnector;
84 * Returns the name of the plugin that sent the reply.
86 * @return The name of the plugin that sent the reply
88 public String pluginName() {
93 * Returns the identifier of the initial request.
95 * @return The identifier of the initial request
97 public String identifier() {
102 * Returns the fields containing the reply.
104 * @return The fields containing the reply
106 public SimpleFieldSet fieldSet() {
111 * Returns the optional data of the reply.
113 * @return The optional data of the reply (may be {@code null})
115 public Bucket data() {