b3e26c7db46d63142e482dc4e437e9bf686e7929
[rhynodge.git] / src / main / java / net / pterodactylus / reactor / output / Output.java
1 /*
2  * Reactor - Output.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.reactor.output;
19
20 import net.pterodactylus.reactor.Trigger;
21
22 /**
23  * Defines the output of a {@link Trigger}. As different output has to be
24  * generated for different media, the {@link #text(String, int)} method takes as
25  * an argument the MIME type of the desired output.
26  *
27  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28  */
29 public interface Output {
30
31         /**
32          * Returns a short summary that can be included e. g. in the subject of an
33          * email.
34          *
35          * @return A short summary of the output
36          */
37         String summary();
38
39         /**
40          * Returns the text for the given MIME type and the given maximum length.
41          * Note that the maximum length does not need to be enforced at all costs;
42          * implementation are free to return texts longer than the given number of
43          * characters.
44          *
45          * @param mimeType
46          *            The MIME type of the text (“text/plain” and “text/html” should
47          *            be supported by all {@link Trigger}s)
48          * @param maxLength
49          *            The maximum length of the returned text (may be &lt; {@code 0}
50          *            to indicate no length restriction)
51          * @return The text for the given MIME type, or {@code null} if there is no
52          *         text defined for the given MIME type
53          */
54         String text(String mimeType, int maxLength);
55
56 }