NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.address
Class NetObject

java.lang.Object
  |
  +--gov.nist.core.GenericObject
        |
        +--gov.nist.javax.sip.address.NetObject
Direct Known Subclasses:
AddressImpl, Authority, GenericURI, TelephoneNumber, UserInfo

public abstract class NetObject
extends GenericObject

Root object for all objects in this package.

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

Constructor Summary
NetObject()
          Default constructor
 
Method Summary
 Object clone()
          For any object in the object (like SIPHeaders) that are cloneable clone the object and add it to the returned List.
 String debugDump()
          An introspection based string formatting method.
 String debugDump(int indent)
          Formatter with a given starting indentation (for nested structs).
abstract  String encode()
          Encode into canonical form.
 boolean equals(Object that)
          An introspection based equality predicate for SIPObjects.
 boolean match(Object other)
          An introspection based predicate matching using a template object.
 void merge(Object mergeObject)
          Recursively override the fields of this object with the fields of a new object.
 void replace(Match regexp, GenericObject replacement)
          Do a find and replace of objects based on regular expression matching of fields.
 void replace(Match regexp, GenericObjectList replacement)
          Do a recursive find and replace of objects pointed to by this object based on regular expression pattern matching.
 void replace(String objectText, GenericObject replacement, boolean matchSubstring)
          Do a find and replace of objects
 void replace(String objectText, GenericObjectList replacement, boolean matchSubstring)
          Do a find and replace of objects.
 String toString()
          Encode this to a string.
 
Methods inherited from class gov.nist.core.GenericObject
getClassFromName, getMatcher, isMySubclass, setMatcher
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetObject

public NetObject()
Default constructor

Method Detail

clone

public Object clone()
For any object in the object (like SIPHeaders) that are cloneable clone the object and add it to the returned List. Strings and wrappers of basic types are cloned by creating new objects. For other objects, if there is a clone method, then this is invoked and the cloned object appears in the result. Otherwise, this just copies the object reference over. NOTE that this method cannot be moved to the superclass because the superclass is in a different package (and we need to access protected fields from here).

Overrides:
clone in class GenericObject
Returns:
Object
Since:
1.0

encode

public abstract String encode()
Encode into canonical form.

Specified by:
encode in class GenericObject
Returns:
String

equals

public boolean equals(Object that)
An introspection based equality predicate for SIPObjects.

Overrides:
equals in class GenericObject
Returns:
true if the objects are euqal and false otherwise

replace

public void replace(String objectText,
                    GenericObject replacement,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a find and replace of objects

Overrides:
replace in class GenericObject
Parameters:
objectText - is the canonical string representation of the object that we want to replace.
replacement - is the object that we want to replace it with.
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 (see the matchSubstring flag) as objectText and with the same class as replacement.
Throws:
IllegalArgumentException - on null args and if replacementObject does not derive from GenericObject or GenericObjectList
Since:
v1.0

merge

public void merge(Object mergeObject)
Recursively override the fields of this object with the fields of a new object. This is useful when you want to genrate a template and override the fields of an incoming SIPMessage with another SIP message that you have already generated.

Overrides:
merge in class GenericObject
Parameters:
mergeObject - is the replacement object. The override obect must be of the same class as this object. Set any fields that you do not want to override as null in the mergeOject object.

replace

public void replace(String objectText,
                    GenericObjectList replacement,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a find and replace of objects.

Overrides:
replace in class GenericObject
Parameters:
objectText - Canonical string representation of the portion we want to replace.
replacement - object we want to replace this portion with. A replacement will occur if a portion of the structure is found with the matching encoded text as objectText and with the same class as the replacement.
matchSubstring - is true if we want to match the encoded text of a candidate object as a substring of the encoded target text. ( match occurs is objectText is a substring of the encoded text of an object with the same class as replacement.)
Throws:
IllegalArgumentException - on null args and if replacementObject does not derive from GenericObject or GenericObjectList
Since:
v1.0

match

public boolean match(Object other)
An introspection based predicate matching using a template object. Allows for partial match of two protocl Objects.

Overrides:
match in class GenericObject
Parameters:
other - the match pattern to test against. The match object has to be of the same type (class). Primitive types and non-sip fields that are non null are matched for equality. Null in any field matches anything. Some book-keeping fields are ignored when making the comparison.
Returns:
true if match succeeds false otherwise.

debugDump

public String debugDump()
An introspection based string formatting method. We need this because in this package (although it is an exact duplicate of the one in the superclass) because it needs to access the protected members of the other objects in this class.

Overrides:
debugDump in class GenericObject
Returns:
String

replace

public void replace(Match regexp,
                    GenericObjectList replacement)
             throws IllegalArgumentException
Do a recursive find and replace of objects pointed to by this object based on regular expression pattern matching.

Overrides:
replace in class GenericObject
Parameters:
regexp - regular expression for the object we want to find. This is generated using a regular expression matching package such as the apache regexp package.
replacement - object we want to replace this portion with. A replacement will occur if a portion of the structure is found with a match of the encoded text with objectText and with the same class as replacement.
IllegalArgumentException
Since:
v1.0

replace

public void replace(Match regexp,
                    GenericObject replacement)
             throws IllegalArgumentException
Do a find and replace of objects based on regular expression matching of fields.

Overrides:
replace in class GenericObject
Parameters:
regexp - is the match expression (i.e. implementation of the Match interface) for the object that we want to replace.
replacement - is the object that we want to replace it with. A replacement will occur if a portion of the structure is found that matches according to the given regexp and if the class of the replaced field matches the replacement.
IllegalArgumentException

debugDump

public String debugDump(int indent)
Formatter with a given starting indentation (for nested structs).

Overrides:
debugDump in class GenericObject
Parameters:
indent - int to set
Returns:
String

toString

public String toString()
Encode this to a string.

Overrides:
toString in class Object
Returns:
string representation for this object.

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.