27c37f7389d1e12db8942531377adc1eecc16e82
[jSite2.git] / src / net / pterodactylus / util / fcp / ARK.java
1 package net.pterodactylus.util.fcp;
2
3 /**
4  * Container for ARKs (address resolution keys).
5  * 
6  * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
7  * @version $Id$
8  */
9 public class ARK {
10
11         /** The public URI of the ARK. */
12         private final String publicURI;
13
14         /** The number of the ARK. */
15         private final int number;
16
17         /**
18          * Creates a new ARK with the given URI and number.
19          * 
20          * @param publicURI
21          *            The public URI of the ARK
22          * @param number
23          *            The number of the ARK
24          */
25         public ARK(String publicURI, String number) {
26                 if ((publicURI == null) || (number == null)) {
27                         throw new NullPointerException(((publicURI == null) ? "publicURI" : "number") + " must not be null");
28                 }
29                 this.publicURI = publicURI;
30                 try {
31                         this.number = Integer.valueOf(number);
32                 } catch (NumberFormatException nfe1) {
33                         throw new IllegalArgumentException("number must be numeric", nfe1);
34                 }
35         }
36
37         /**
38          * Returns the public URI of the ARK.
39          * 
40          * @return The public URI of the ARK
41          */
42         public String getPublicURI() {
43                 return publicURI;
44         }
45
46         /**
47          * Returns the number of the ARK.
48          * 
49          * @return The number of the ARK
50          */
51         public int getNumber() {
52                 return number;
53         }
54
55 }