org.lastbamboo.common.sdp
Class NameValueList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList
                  extended by org.lastbamboo.common.sdp.GenericObjectList
                      extended by org.lastbamboo.common.sdp.NameValueList
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, Deque, List, Queue

public class NameValueList
extends GenericObjectList

Implements a simple NameValue association with a quick lookup function (via a hash table) this class is not thread safe because it uses HashTables.

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

Field Summary
 
Fields inherited from class org.lastbamboo.common.sdp.GenericObjectList
AND, AT, COLON, COMMA, DOT, DOUBLE_QUOTE, EQUALS, GREATER_THAN, HT, indentation, LESS_THAN, listName, LPAREN, myClass, NEWLINE, PERCENT, POUND, QUESTION, QUOTE, RETURN, RPAREN, SEMICOLON, separator, SLASH, SP, STAR
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
NameValueList()
          default constructor.
NameValueList(String listName)
           
 
Method Summary
 void add(NameValue nv)
           
 void add(String name, Object obj)
          Add a name value record to this list.
 boolean delete(String name)
          Remove the element corresponding to this name.
 boolean equals(Object otherObject)
          Compare if two NameValue lists are equal.
 Iterator getIterator()
          Get the list iterator for this list.
 Iterator getNames()
          Get a list of parameter names.
 NameValue getNameValue(String name)
          Get the NameValue record given a name.
 String getParameter(String name)
          Get the parameter as a String.
 Object getValue(String name)
          Do a lookup on a given name and return value associated with it.
 boolean hasNameValue(String name)
          Returns a boolean telling if this NameValueList has a record with this name
 void set(NameValue nv)
          Set a namevalue object in this list.
 void set(String name, Object value)
          Set a namevalue object in this list.
 
Methods inherited from class org.lastbamboo.common.sdp.GenericObjectList
add, add, addFirst, clone, concatenate, concatenate, debugDump, debugDump, encode, first, getIndentation, getMyClass, isCloneable, isMySubclass, match, mergeObjects, next, next, replace, replace, replace, replace, setMyClass, setSeparator, toString
 
Methods inherited from class java.util.LinkedList
add, addAll, addAll, addLast, clear, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

NameValueList

public NameValueList(String listName)

NameValueList

public NameValueList()
default constructor.

Method Detail

add

public void add(NameValue nv)

set

public void set(NameValue nv)
Set a namevalue object in this list.


set

public void set(String name,
                Object value)
Set a namevalue object in this list.


add

public void add(String name,
                Object obj)
Add a name value record to this list.


equals

public boolean equals(Object otherObject)
Compare if two NameValue lists are equal.

Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class GenericObjectList
Parameters:
otherObject - is the object to compare to.
Returns:
true if the two objects compare for equality.

getValue

public Object getValue(String name)
Do a lookup on a given name and return value associated with it.


getNameValue

public NameValue getNameValue(String name)
Get the NameValue record given a name.

Since:
1.0

hasNameValue

public boolean hasNameValue(String name)
Returns a boolean telling if this NameValueList has a record with this name

Since:
1.0

delete

public boolean delete(String name)
Remove the element corresponding to this name.

Since:
1.0

getIterator

public Iterator getIterator()
Get the list iterator for this list.

Overrides:
getIterator in class GenericObjectList

getNames

public Iterator getNames()
Get a list of parameter names.

Returns:
a list iterator that has the names of the parameters.

getParameter

public String getParameter(String name)
Get the parameter as a String.

Returns:
the parameter as a string.


Copyright © 2013 LittleShoot. All Rights Reserved.