Expose lots of constructors and accessors
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / SubscribedUSKUpdate.java
1 /*
2  * jFCPlib - SubscribedUSKUpdate.java - Copyright © 2008 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 2 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, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 package net.pterodactylus.fcp;
20
21 /**
22  * A “SubscribedUSKUpdate” message is sent each time a new edition of a USK
23  * that was previously subscribed to with {@link SubscribeUSK} was found. Note
24  * that if the new edition that was found is several editions ahead of the
25  * currently last known edition, you will received a SubscribedUSKUpdate for
26  * each edition inbetween as welL!
27  *
28  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29  */
30 public class SubscribedUSKUpdate extends BaseMessage implements Identifiable {
31
32         /**
33          * Creates a new “SubscribedUSKUpdate” message that wraps the received
34          * message.
35          *
36          * @param receivedMessage
37          *            The received message
38          */
39         public SubscribedUSKUpdate(FcpMessage receivedMessage) {
40                 super(receivedMessage);
41         }
42
43         /**
44          * Returns the identifier of the subscription.
45          *
46          * @return The identifier of the subscription
47          */
48         @Override
49         public String getIdentifier() {
50                 return getField("Identifier");
51         }
52
53         /**
54          * Returns the new edition that was found.
55          *
56          * @return The new edition
57          */
58         public int getEdition() {
59                 return FcpUtils.safeParseInt(getField("Edition"));
60         }
61
62         /**
63          * Returns the complete URI, including the new edition.
64          *
65          * @return The complete URI
66          */
67         public String getURI() {
68                 return getField("URI");
69         }
70
71 }