NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.header
Class SIPObjectList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.AbstractSequentialList
                    |
                    +--java.util.LinkedList
                          |
                          +--gov.nist.core.GenericObjectList
                                |
                                +--gov.nist.javax.sip.header.SIPObjectList
All Implemented Interfaces:
Cloneable, Collection, List, Serializable

public class SIPObjectList
extends GenericObjectList

Root class for all the collection objects in this list: a wrapper class on the GenericObjectList class for lists of objects that can appear in SIPObjects. IMPORTANT NOTE: SIPObjectList cannot derive from SIPObject.

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan
This code is in the public domain.
See Also:
Serialized Form

Constructor Summary
SIPObjectList()
          Construct an empty SIPObjectList.
SIPObjectList(String lname)
          Construct a SIPObject List given a list name.
SIPObjectList(String lname, Class cname)
          Construct a SIPObject List given a list name and a class for the objects that go into the list.
SIPObjectList(String lname, String cname)
          Construct a SIPObject List given a list name and a class for the objects that go into the list.
 
Method Summary
 void add(SIPObject obj)
          Add a new object to the list.
 void addFirst(SIPObject obj)
          Add a new object to the top of this list.
 Object clone()
          Make a clone of this header list and return it.
 void concatenate(SIPObjectList otherList)
          Append a given list to the end of this list.
 void concatenate(SIPObjectList otherList, boolean topFlag)
          Append or prepend a given list to this list.
 String debugDump(int indent)
          Convert to a string given an indentation(for pretty printing).
 GenericObject first()
          Get the first object of this list.
 Class getMyClass()
          Get the class of the supported objects of this list.
 void mergeObjects(GenericObjectList mergeList)
          Do a merge of the GenericObjects contained in this list with the GenericObjects in the mergeList.
 GenericObject next()
          Get the next object of this list (assumes that first() has been called prior to calling this method.)
 GenericObject next(ListIterator li)
          Get the next object of this list.
 Object removeFirst()
          Remove the first object of this list.
 Object removeLast()
          Remove the last object from this list.
 void replace(String objectText, GenericObject replacementObject, boolean matchSubstring)
          Do a recursive find and replace of objects pointed to by this object.
 void replace(String objectText, GenericObjectList replacementObject, boolean matchSubstring)
          Do a recursive find and replace of objects pointed to by this object.
 void setMyClass(Class cl)
          Set the class of the supported objects of this list.
 
Methods inherited from class gov.nist.core.GenericObjectList
add, addFirst, debugDump, encode, equals, getIterator, isMySubclass, match, replace, replace, setSeparator, toString
 
Methods inherited from class java.util.LinkedList
add, addAll, addAll, addLast, clear, contains, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, remove, remove, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
hashCode, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

SIPObjectList

public SIPObjectList(String lname)
Construct a SIPObject List given a list name.

Parameters:
lname - String to set

SIPObjectList

public SIPObjectList(String lname,
                     Class cname)
Construct a SIPObject List given a list name and a class for the objects that go into the list.

Parameters:
lname - String to set
cname - Class to set

SIPObjectList

public SIPObjectList(String lname,
                     String cname)
Construct a SIPObject List given a list name and a class for the objects that go into the list.

Parameters:
lname - String to set
cname - String to set

SIPObjectList

public SIPObjectList()
Construct an empty SIPObjectList.

Method Detail

add

public void add(SIPObject obj)
Add a new object to the list.

Parameters:
obj - SIPObject to set

addFirst

public void addFirst(SIPObject obj)
Add a new object to the top of this list.

Parameters:
obj - SIPObject to set

clone

public Object clone()
Make a clone of this header list and return it. For any object in the list (like SIPHeaders) that inherits from GenericObject or GenericObjectList, clone the object and add it to the returned List. For objects that do not, this just copies the reference over. WARNING.. NO CIRCULAR REFERENCES that are accessible are tolerated (will throw this method into an infinite loop). However, we dont (shouldnt) have such worries because the parser generates tree sturctures. This belongs here and not in the superclass because we need to directly access protected fields.

Overrides:
clone in class GenericObjectList
Returns:
clone of this header
Since:
1.0

mergeObjects

public void mergeObjects(GenericObjectList mergeList)
Do a merge of the GenericObjects contained in this list with the GenericObjects in the mergeList. Note that this does an inplace modification of the given list. This does an object by object merge of the given objects.

Overrides:
mergeObjects in class GenericObjectList
Parameters:
mergeList - is the list of Generic objects that we want to do an object by object merge with. Note that no new objects are added to this list.

concatenate

public void concatenate(SIPObjectList otherList)
Append a given list to the end of this list.

Parameters:
otherList - SIPObjectList to set

concatenate

public void concatenate(SIPObjectList otherList,
                        boolean topFlag)
Append or prepend a given list to this list.

Parameters:
otherList - SIPObjectList to set
topFlag - boolean to set

first

public GenericObject first()
Get the first object of this list.

Overrides:
first in class GenericObjectList
Returns:
GenericObject

getMyClass

public Class getMyClass()
Get the class of the supported objects of this list.

Overrides:
getMyClass in class GenericObjectList
Returns:
Class

next

public GenericObject next()
Get the next object of this list (assumes that first() has been called prior to calling this method.)

Overrides:
next in class GenericObjectList
Returns:
GenericObject

next

public GenericObject next(ListIterator li)
Get the next object of this list.

Overrides:
next in class GenericObjectList
Parameters:
li - ListIterator to set
Returns:
GenericObject

removeFirst

public Object removeFirst()
Remove the first object of this list.

Overrides:
removeFirst in class LinkedList
Returns:
Object removed

removeLast

public Object removeLast()
Remove the last object from this list.

Overrides:
removeLast in class LinkedList
Returns:
Object removed

debugDump

public String debugDump(int indent)
Convert to a string given an indentation(for pretty printing). This is useful for debugging the system in lieu of a debugger.

Overrides:
debugDump in class GenericObjectList
Parameters:
indent - int to set
Returns:
an indentation

setMyClass

public void setMyClass(Class cl)
Set the class of the supported objects of this list.

Overrides:
setMyClass in class GenericObjectList
Parameters:
cl - Class to set

replace

public void replace(String objectText,
                    GenericObject replacementObject,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a recursive find and replace of objects pointed to by this object. You might find this handy if you are writing a proxy server.

Overrides:
replace in class GenericObjectList
Parameters:
objectText - is the canonical string representation of the object that we want to replace.
replacementObject - is the object that we want to replace it with (must be a subclass of GenericObject or GenericObjectList).
matchSubstring - a boolean which tells if we should match a substring of the target object A replacement will occur if a portion of the structure is found with matching encoded text as objectText and with the same class as replacement. (i.e. if matchSubstring is true an object is a candidate for replacement if objectText is a substring of candidate.encode() && candidate.class.equals(replacement.class) otherwise the match test is an equality test.)
Throws:
IllegalArgumentException - on null args or if replacementObject does not derive from GenericObject or GenericObjectList

replace

public void replace(String objectText,
                    GenericObjectList replacementObject,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a recursive find and replace of objects pointed to by this object.

Overrides:
replace in class GenericObjectList
Parameters:
objectText - is the canonical string representation of the object that we want to replace.
replacementObject - is the object that we want to replace it with (must be a subclass of GenericObject or GenericObjectList).
matchSubstring - a boolean which tells if we should match a substring of the target object A replacement will occur if a portion of the structure is found with matching encoded text as objectText and with the same class as replacement. (i.e. if matchSubstring is true an object is a candidate for replacement if objectText is a substring of candidate.encode() && candidate.class.equals(replacement.class) otherwise the match test is an equality test.)
Throws:
IllegalArgumentException - on null args or if replacementObject does not derive from GenericObject or GenericObjectList

NIST SIP Parser and Stack (v1.2) API

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Get the latest distribution.
Submit a bug report or feature request.