2 * Sone - ReceivedReplyEvent.java - Copyright © 2013–2019 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 public class ReceivedReplyEvent {
29 /** The connector that received the reply. */
30 private final PluginConnector pluginConnector;
32 /** The name of the plugin that sent the reply. */
33 private final String pluginName;
35 /** The identifier of the initial request. */
36 private final String identifier;
38 /** The fields containing the reply. */
39 private final SimpleFieldSet fieldSet;
41 /** The optional reply data. */
42 private final Bucket data;
45 * Creates a new “reply received” event.
47 * @param pluginConnector
48 * The connector that received the event
50 * The name of the plugin that sent the reply
52 * The identifier of the initial request
54 * The fields containing the reply
56 * The optional data of the reply
58 public ReceivedReplyEvent(PluginConnector pluginConnector, String pluginName, String identifier, SimpleFieldSet fieldSet, Bucket data) {
59 this.pluginConnector = pluginConnector;
60 this.pluginName = pluginName;
61 this.identifier = identifier;
62 this.fieldSet = fieldSet;
71 * Returns the plugin connector that received the reply.
73 * @return The plugin connector that received the reply
75 public PluginConnector pluginConnector() {
76 return pluginConnector;
80 * Returns the name of the plugin that sent the reply.
82 * @return The name of the plugin that sent the reply
84 public String pluginName() {
89 * Returns the identifier of the initial request.
91 * @return The identifier of the initial request
93 public String identifier() {
98 * Returns the fields containing the reply.
100 * @return The fields containing the reply
102 public SimpleFieldSet fieldSet() {
107 * Returns the optional data of the reply.
109 * @return The optional data of the reply (may be {@code null})
111 public Bucket data() {