org.ceryle.util
Class LinkRef

java.lang.Object
  extended by org.ceryle.util.LinkRef
All Implemented Interfaces:
Comparable

public class LinkRef
extends Object
implements Comparable

Encapsulates a web link, suitable for use in lists, etc. A LinkRef includes a required URL reference with its optional link text:

     <a href="http://www.sealioncaves.com/webcam/">Sea Lion Caves WebCam</a>
 

Since:
JDK1.2
Version:
$Id: LinkRef.java,v 3.4 2007-06-15 12:09:55 altheim Exp $
Author:
Murray Altheim

Field Summary
static boolean compareCaseSensitive
          When true, sorting (using the Comparable interface) on link text is case sensitive.
 
Constructor Summary
LinkRef(String uri, String linktext)
          Constructor with a required URI and an optional link text, both as Strings.
 
Method Summary
 int compareTo(Object o)
          Returns 0 if the provided LinkRef has the same URI and text as this, and +1 or -1 based on sort order on the two titles.
 String getText()
          Returns the link text as a String.
 String getURI()
          Returns the link URI as a String.
 boolean hasText()
          Returns true if the link text has been set.
 void setText(String text)
          Sets the link text to the String text.
 void setURI(String uri)
          Sets the link URI to the String uri.
 String toString()
          Return a String representation of this LinkRef, ie., its link text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compareCaseSensitive

public static boolean compareCaseSensitive
When true, sorting (using the Comparable interface) on link text is case sensitive.

Constructor Detail

LinkRef

public LinkRef(String uri,
               String linktext)
Constructor with a required URI and an optional link text, both as Strings. If the URI is null or empty, throws an

Method Detail

setURI

public void setURI(String uri)
Sets the link URI to the String uri.


getURI

public String getURI()
Returns the link URI as a String.


hasText

public boolean hasText()
Returns true if the link text has been set.


setText

public void setText(String text)
Sets the link text to the String text.


getText

public String getText()
Returns the link text as a String. If it has not been set, returns the link URI. This is the same as toString().


toString

public String toString()
Return a String representation of this LinkRef, ie., its link text. If unavailable, returns the URI itself.

Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
Returns 0 if the provided LinkRef has the same URI and text as this, and +1 or -1 based on sort order on the two titles. If compareCaseSensitive is true, case is significant.

Specified by:
compareTo in interface Comparable


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.