d5da73062955181f873a701d0c6bfa60ea8bd2e8
[Sone.git] / src / main / java / net / pterodactylus / sone / text / LinkPart.java
1 /*
2  * Sone - LinkPart.java - Copyright © 2011 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.sone.text;
19
20 /**
21  * {@link Part} implementation that can hold a link. A link contains of three
22  * attributes: the link itself, the text that is shown instead of the link, and
23  * an explanatory text that can be displayed e.g. as a tooltip.
24  *
25  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
26  */
27 public class LinkPart implements Part {
28
29         /** The link of this part. */
30         private final String link;
31
32         /** The text of this part. */
33         private final String text;
34
35         /** The title of this part. */
36         private final String title;
37
38         /**
39          * Creates a new link part.
40          *
41          * @param link
42          *            The link of the link part
43          * @param text
44          *            The text of the link part
45          */
46         public LinkPart(String link, String text) {
47                 this(link, text, text);
48         }
49
50         /**
51          * Creates a new link part.
52          *
53          * @param link
54          *            The link of the link part
55          * @param text
56          *            The text of the link part
57          * @param title
58          *            The title of the link part
59          */
60         public LinkPart(String link, String text, String title) {
61                 this.link = link;
62                 this.text = text;
63                 this.title = title;
64         }
65
66         //
67         // ACCESSORS
68         //
69
70         /**
71          * Returns the link of this part.
72          *
73          * @return The link of this part
74          */
75         public String getLink() {
76                 return link;
77         }
78
79         /**
80          * Returns the text of this part.
81          *
82          * @return The text of this part
83          */
84         public String getText() {
85                 return text;
86         }
87
88         /**
89          * Returns the title of this part.
90          *
91          * @return The title of this part
92          */
93         public String getTitle() {
94                 return title;
95         }
96
97 }