com.novell.sentinel.uri
Class GenericURI.Fragment

java.lang.Object
  extended by com.novell.sentinel.uri.GenericURI.Fragment
Enclosing class:
GenericURI

public static class GenericURI.Fragment
extends Object

A class used to parse and output the fragment component of a URI.


Field Summary
static PercentCodex FRAGMENT_CODEX
          An encoder that encodes a URI fragment component.
 
Constructor Summary
GenericURI.Fragment()
          Construct an empty instance.
GenericURI.Fragment(GenericURI.Fragment src)
          Construct a deep copy of the passed instance.
GenericURI.Fragment(String rawFragment)
          Construct an instance from the passed, raw string.
 
Method Summary
 String getFragment()
          Get the parsed, decoded fragment string.
 String getRaw()
          Get the raw, unparsed, un-decoded string used to construct or set the data in this instance.
 boolean isEmpty()
          Return true if there is no data associated with this instance.
 void set(String rawFragment)
          Set the data in this instance from the passed raw, encoded string.
 void setLiteral(String literal)
          Set the data in this instance from the passed literal (i.e., unencoded) string.
protected  void setRaw(String raw)
          Set the raw string.
 String toString()
          Output the fragment string as an encoded string suitable for use in a constructed URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FRAGMENT_CODEX

public static final PercentCodex FRAGMENT_CODEX
An encoder that encodes a URI fragment component. The reserved characters (those that are percent encoded in a constructed URI string) are: ':', '#', '[', ']','@'.

Constructor Detail

GenericURI.Fragment

public GenericURI.Fragment()
Construct an empty instance.


GenericURI.Fragment

public GenericURI.Fragment(String rawFragment)
Construct an instance from the passed, raw string.

Parameters:
rawFragment - The encoded, raw fragment component.

GenericURI.Fragment

public GenericURI.Fragment(GenericURI.Fragment src)
Construct a deep copy of the passed instance.

Parameters:
src - The instance to be copied.
Method Detail

isEmpty

public boolean isEmpty()
Return true if there is no data associated with this instance. (Note: A URI with a trailing '#' is considered to have a non-empty fragment).

Returns:
true if there is no fragment.

getRaw

public String getRaw()
Get the raw, unparsed, un-decoded string used to construct or set the data in this instance.

Returns:
The raw string, or null. If the structured setter has been used (i.e., setLiteral(String) then there is no raw data.

setRaw

protected void setRaw(String raw)
Set the raw string. This is designed to be used in conjunction with the various setters. If a structured setter is used, the raw data should be set to null.

Parameters:
raw - The string to set, or null.

getFragment

public String getFragment()
Get the parsed, decoded fragment string.

Returns:
The fragment string, if any (may be null).

set

public void set(String rawFragment)
Set the data in this instance from the passed raw, encoded string.

Parameters:
rawFragment - The raw string.

setLiteral

public void setLiteral(String literal)
Set the data in this instance from the passed literal (i.e., unencoded) string.

Parameters:
literal - The fragment string.

toString

public String toString()
Output the fragment string as an encoded string suitable for use in a constructed URI.

Overrides:
toString in class Object