From: David ‘Bombe’ Roden Date: Thu, 3 Jan 2013 15:37:05 +0000 (+0100) Subject: Defines output that will be processed by actions. X-Git-Tag: 0.1~89 X-Git-Url: https://git.pterodactylus.net/?p=rhynodge.git;a=commitdiff_plain;h=e84b68e4e7e96d402943512a32109c0edc35beec Defines output that will be processed by actions. --- diff --git a/src/main/java/net/pterodactylus/reactor/output/Output.java b/src/main/java/net/pterodactylus/reactor/output/Output.java new file mode 100644 index 0000000..b3e26c7 --- /dev/null +++ b/src/main/java/net/pterodactylus/reactor/output/Output.java @@ -0,0 +1,56 @@ +/* + * Reactor - Output.java - Copyright © 2013 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.reactor.output; + +import net.pterodactylus.reactor.Trigger; + +/** + * Defines the output of a {@link Trigger}. As different output has to be + * generated for different media, the {@link #text(String, int)} method takes as + * an argument the MIME type of the desired output. + * + * @author David ‘Bombe’ Roden + */ +public interface Output { + + /** + * Returns a short summary that can be included e. g. in the subject of an + * email. + * + * @return A short summary of the output + */ + String summary(); + + /** + * Returns the text for the given MIME type and the given maximum length. + * Note that the maximum length does not need to be enforced at all costs; + * implementation are free to return texts longer than the given number of + * characters. + * + * @param mimeType + * The MIME type of the text (“text/plain” and “text/html” should + * be supported by all {@link Trigger}s) + * @param maxLength + * The maximum length of the returned text (may be < {@code 0} + * to indicate no length restriction) + * @return The text for the given MIME type, or {@code null} if there is no + * text defined for the given MIME type + */ + String text(String mimeType, int maxLength); + +}