com.artima.place
Class URLString

java.lang.Object
  |
  +--com.artima.place.URLString
All Implemented Interfaces:
java.io.Serializable

public final class URLString
extends java.lang.Object
implements java.io.Serializable

Holds a valid URL String.

This is not clonable because its immutable.

See Also:
Serialized Form

Constructor Summary
URLString(java.lang.String url)
          Constructs a URLString with passed String URL.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified Object with this URLString for equality.
 java.lang.String getFile()
          Returns the file portion of the URL.
 java.lang.String getHost()
          Returns the host portion of the URL.
 int getPort()
          Returns the port portion of the URL.
 java.lang.String getProtocol()
          Returns the protocol portion of the URL.
 java.lang.String getRef()
          Returns the reference portion of the URL.
 int hashCode()
          Returns the hash code value for this URLString.
 java.lang.String toString()
          Returns the String URL that's stored in this URLString.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLString

public URLString(java.lang.String url)
          throws java.net.MalformedURLException
Constructs a URLString with passed String URL.
Parameters:
url - The String URL to hold in this URLString
Throws:
NullPointerException - if the URL String reference passed to this constructor is null
java.net.MalformedURLException - if the String passed to this constructor is does not have the form of a valid URL.
Method Detail

toString

public java.lang.String toString()
Returns the String URL that's stored in this URLString.
Overrides:
toString in class java.lang.Object
Returns:
the String URL held in this URLString

getProtocol

public java.lang.String getProtocol()
Returns the protocol portion of the URL.
Returns:
the String protocol portion of the URL

getHost

public java.lang.String getHost()
Returns the host portion of the URL.
Returns:
the String host portion of the URL

getPort

public int getPort()
Returns the port portion of the URL.
Returns:
the port portion of the URL, represented as an int, or -1, if no port is specified in this URL.

getFile

public java.lang.String getFile()
Returns the file portion of the URL.
Returns:
the String file portion of the URL

getRef

public java.lang.String getRef()
Returns the reference portion of the URL.
Returns:
the String reference portion of the URL

equals

public boolean equals(java.lang.Object o)
Compares the specified Object with this URLString for equality. Two URLStrings are semantically equal if their String URLs have the same value.
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare to this one.
Returns:
true if this object is semantically equal to the passed object.

hashCode

public int hashCode()
Returns the hash code value for this URLString. The hashcode for a URLString is the hashcode for the URLString's constituent String URL.
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code for this object.