ca.cbc.sportwire.servlet.data
Class PathList
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--ca.cbc.sportwire.servlet.data.PathList
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable
- Direct Known Subclasses:
- PathBean
- public class PathList
- extends java.util.ArrayList
PathList: creates an array-list from the elements of the
pathinfo
(requestURI) string by breaking the string on
file.separator
. Extends the normal ArrayList behaviour
by returning null strings when asked for an element outside the
list. This makes it safer to use with Velocity; you can test if
$path.getLevel(2).equals("")
if you need to
check. Also overrides the base get() method to return null for out
of bounds requests.
Created: Thu Dec 13 00:58:14 2001
$Log: PathList.java,v $
Revision 1.9 2002/02/18 20:34:04 garym
implement ad-hoc SQL from $sql.dom()
Revision 1.8 2002/02/08 04:42:33 garym
findfile accommodates missing file separator; wildcard paths support
Revision 1.7 2002/02/04 21:08:38 garym
Added bounds checking to PathList.get(); now returns null
Revision 1.6 2002/01/29 21:43:41 garym
Fixed concurrent mod bug
Revision 1.5 2002/01/24 19:50:20 garym
Major restructuring of beans and pagehandlers
Revision 1.4 2002/01/22 22:34:48 garym
Fixed news slug case bug
Revision 1.3 2002/01/14 21:51:46 garym
bug fixes in topics and config files migration to Extended Properties
Revision 1.2 2002/01/09 04:28:59 garym
Added test unit stubs and new News support
Revision 1.1 2001/12/16 22:01:56 garym
fixes to default page handling
- Version:
- $Id: PathList.java,v 1.9 2002/02/18 20:34:04 garym Exp $
- Author:
- Gary Lawrence Murphy
- See Also:
- Serialized Form
Field Summary |
(package private) static org.apache.log4j.Category |
cat
|
Fields inherited from class java.util.ArrayList |
elementData, serialVersionUID, size |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
PathList()
PathList constructor sets the initial array size
to 3 |
PathList(java.lang.String pathinfo)
PathList constructor takes the URI and uses this
to build an internal array list of the parts (excluding null
strings). |
Method Summary |
java.lang.Object |
get(int ord)
get : overrides base method to add bounds checking;
returns a null for out of bounds requests. |
int |
getDepth()
getDepth : lets Velocity use
$path.depth to get the array size |
java.lang.String |
getLevel(int ordinal)
getLevel : returns the element of the path in a
one-based sense, and returns an empty string if your request is
out of bounds. |
java.lang.String |
getLevel(int ordinal,
java.lang.String perlsub)
getLevel : returns the element of the path passed
through the given perl substitution pattern (using JORO). |
void |
setPath(java.lang.String pathinfo)
setPath : builds the path array from a string using
the local O/S file separator. |
java.lang.String |
toString()
toString : returns the pathinfo so that Velocity
$path returns the actual path. |
Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, indexOf, isEmpty, lastIndexOf, RangeCheck, readObject, remove, removeRange, set, size, toArray, toArray, trimToSize, writeObject |
Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
Methods inherited from class java.lang.Object |
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
cat
static org.apache.log4j.Category cat
PathList
public PathList()
PathList
constructor sets the initial array size
to 3
PathList
public PathList(java.lang.String pathinfo)
PathList
constructor takes the URI and uses this
to build an internal array list of the parts (excluding null
strings).
- Parameters:
pathinfo
- a String
value
setPath
public void setPath(java.lang.String pathinfo)
setPath
: builds the path array from a string using
the local O/S file separator. Although this method is
synchronized, it does not guarantee against read-access during
the rebuild.
- Parameters:
pathinfo
- a String
value
toString
public java.lang.String toString()
toString
: returns the pathinfo so that Velocity
$path
returns the actual path.
- Overrides:
toString
in class java.util.AbstractCollection
- Returns:
- a
String
value
getDepth
public int getDepth()
getDepth
: lets Velocity use
$path.depth
to get the array size
- Returns:
- an
int
value
get
public java.lang.Object get(int ord)
get
: overrides base method to add bounds checking;
returns a null for out of bounds requests.
- Overrides:
get
in class java.util.ArrayList
- Parameters:
ord
- an int
value- Returns:
- an
Object
value or null if out of bounds
getLevel
public java.lang.String getLevel(int ordinal,
java.lang.String perlsub)
getLevel
: returns the element of the path passed
through the given perl substitution pattern (using JORO).
- Parameters:
ordinal
- an int
valueperlsub
- a String
perl substitution pattern- Returns:
- a
String
value
getLevel
public java.lang.String getLevel(int ordinal)
getLevel
: returns the element of the path in a
one-based sense, and returns an empty string if your request is
out of bounds. This lets you take a path like
/sports/short-track
and assign the "short-track"
string to a gif image or whatever.
- Parameters:
ordinal
- an int
value- Returns:
- a
String
value