org.lastbamboo.common.sdp
Class NameValue

java.lang.Object
  extended by org.lastbamboo.common.sdp.GenericObject
      extended by org.lastbamboo.common.sdp.NameValue
All Implemented Interfaces:
Serializable, Cloneable

public class NameValue
extends GenericObject

Generic structure for storing name-value pairs.

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

Field Summary
protected  boolean isQuotedString
           
protected  String name
           
protected  String quotes
           
protected  String separator
           
protected  Object value
           
 
Fields inherited from class org.lastbamboo.common.sdp.GenericObject
AND, AT, COLON, COMMA, DOT, DOUBLE_QUOTE, EQUALS, GREATER_THAN, HT, immutableClasses, immutableClassNames, indentation, LESS_THAN, LPAREN, matchExpression, NEWLINE, PERCENT, POUND, QUESTION, QUOTE, RETURN, RPAREN, SEMICOLON, SLASH, SP, STAR, stringRepresentation
 
Constructor Summary
NameValue()
           
NameValue(String n, Object v)
           
 
Method Summary
 Object clone()
          Clones this object.
 String encode()
          Get the encoded representation of this namevalue object.
 boolean equals(Object other)
          Equality comparison predicate.
 String getName()
           
 Object getValue()
           
 boolean isValueQuoted()
          Return true if the value is quoted in doublequotes.
 void setName(String n)
          Set the name member
 void setQuotedValue()
          A flag that indicates that doublequotes should be put around the value when encoded (for example name=value when value is doublequoted).
 void setSeparator(String sep)
          Set the separator for the encoding method below.
 void setValue(Object v)
          Set the value member
 
Methods inherited from class org.lastbamboo.common.sdp.GenericObject
Assert, dbgPrint, dbgPrint, debugDump, debugDump, getIndentation, getMatcher, isMySubclass, makeClone, match, merge, replace, replace, replace, replace, setMatcher, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isQuotedString

protected boolean isQuotedString

separator

protected String separator

quotes

protected String quotes

name

protected String name

value

protected Object value
Constructor Detail

NameValue

public NameValue()

NameValue

public NameValue(String n,
                 Object v)
Method Detail

setSeparator

public void setSeparator(String sep)
Set the separator for the encoding method below.


setQuotedValue

public void setQuotedValue()
A flag that indicates that doublequotes should be put around the value when encoded (for example name=value when value is doublequoted).


isValueQuoted

public boolean isValueQuoted()
Return true if the value is quoted in doublequotes.


getName

public String getName()

getValue

public Object getValue()

setName

public void setName(String n)
Set the name member


setValue

public void setValue(Object v)
Set the value member


encode

public String encode()
Get the encoded representation of this namevalue object. Added doublequote for encoding doublequoted values (bug reported by Kirby Kiem).

Specified by:
encode in class GenericObject
Returns:
an encoded name value (eg. name=value) string.
Since:
1.0

clone

public Object clone()
Description copied from class: GenericObject
Clones this object.

Overrides:
clone in class GenericObject

equals

public boolean equals(Object other)
Equality comparison predicate.

Overrides:
equals in class GenericObject
Parameters:
other - is the other object to test against.
Returns:
true if the objects are euqal and false otherwise


Copyright © 2013 LittleShoot. All Rights Reserved.