org.jboss.portal.core.model.portal
Class PortalObjectPath

java.lang.Object
  extended by org.jboss.portal.core.model.portal.PortalObjectPath
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class PortalObjectPath
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A path for a portal object.

Version:
$Revision: 1.1 $
Author:
Julien Viet
See Also:
Serialized Form

Nested Class Summary
static class PortalObjectPath.CanonicalFormat
           
static class PortalObjectPath.Format
          The format of a string representation of an id.
static class PortalObjectPath.LegacyFormat
           
 
Field Summary
static PortalObjectPath.Format CANONICAL_FORMAT
          Canonical format, smth like /a/b/c.
static PortalObjectPath.Format LEGACY_BASE64_FORMAT
           
static PortalObjectPath.Format LEGACY_FORMAT
          The internal format when it is persisted, smth like a.b.c .
static PortalObjectPath ROOT_PATH
          This statement must be executed before the previous one otherwise the empty string array will be null.
 
Constructor Summary
PortalObjectPath()
           
PortalObjectPath(PortalObjectPath that)
          Copy constructor.
PortalObjectPath(java.lang.String[] names)
          Build an id directly from its composing names.
PortalObjectPath(java.lang.String value, PortalObjectPath.Format format)
          Build an id by parsing a string representation.
 
Method Summary
 int compareTo(java.lang.Object o)
          Lexicographical order based implementation on the names atoms.
 boolean equals(java.lang.Object obj)
           
 PortalObjectPath getChild(java.lang.String name)
           
 int getLength()
           
 java.lang.String getName(int index)
           
 PortalObjectPath getParent()
          Return the parent or null if this is the root id.
 int hashCode()
           
 java.util.Iterator names()
          Return an iterator over the different names.
static PortalObjectPath parse(java.lang.String value, PortalObjectPath.Format format)
           
 java.lang.String toString()
          Returns the canonical representation.
 java.lang.String toString(PortalObjectPath.Format format)
          Returns a string representation using a specified format
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_PATH

public static final PortalObjectPath ROOT_PATH
This statement must be executed before the previous one otherwise the empty string array will be null.


CANONICAL_FORMAT

public static final PortalObjectPath.Format CANONICAL_FORMAT
Canonical format, smth like /a/b/c.


LEGACY_FORMAT

public static final PortalObjectPath.Format LEGACY_FORMAT
The internal format when it is persisted, smth like a.b.c .


LEGACY_BASE64_FORMAT

public static final PortalObjectPath.Format LEGACY_BASE64_FORMAT
Constructor Detail

PortalObjectPath

public PortalObjectPath()

PortalObjectPath

public PortalObjectPath(PortalObjectPath that)
                 throws java.lang.IllegalArgumentException
Copy constructor.

Parameters:
that - the id to clone
Throws:
java.lang.IllegalArgumentException - if the argument to clone is null

PortalObjectPath

public PortalObjectPath(java.lang.String[] names)
                 throws java.lang.IllegalArgumentException
Build an id directly from its composing names.

Parameters:
names - the id names
Throws:
java.lang.IllegalArgumentException - if any argument is null or not well formed

PortalObjectPath

public PortalObjectPath(java.lang.String value,
                        PortalObjectPath.Format format)
                 throws java.lang.IllegalArgumentException
Build an id by parsing a string representation.

Parameters:
value - the string representation
format - the string format
Throws:
java.lang.IllegalArgumentException - if any argument is null or not well formed
Method Detail

getParent

public PortalObjectPath getParent()
Return the parent or null if this is the root id.

Returns:
the parent

getChild

public PortalObjectPath getChild(java.lang.String name)

getLength

public int getLength()

getName

public java.lang.String getName(int index)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Lexicographical order based implementation on the names atoms.

Specified by:
compareTo in interface java.lang.Comparable

names

public java.util.Iterator names()
Return an iterator over the different names.

Returns:
the iterator over the names

toString

public java.lang.String toString()
Returns the canonical representation.

Overrides:
toString in class java.lang.Object
Returns:
the string value

toString

public java.lang.String toString(PortalObjectPath.Format format)
Returns a string representation using a specified format

Parameters:
format - the output format
Returns:
the string value

parse

public static PortalObjectPath parse(java.lang.String value,
                                     PortalObjectPath.Format format)