gov.nist.core
クラス GenericObject

java.lang.Object
  上位を拡張 gov.nist.core.GenericObject
すべての実装されたインタフェース:
java.io.Serializable
直系の既知のサブクラス:
Host, HostPort, MessageObject, NameValue, NetObject, SDPObject, SIPObject

public abstract class GenericObject
extends java.lang.Object
implements java.io.Serializable

The base class from which all the other classes in the sipheader, sdpfields and sipmessage packages are extended. Provides a few utility funcitons such as indentation and pretty printing that all other classes benifit from.

バージョン:
JAIN-SIP-1.1
作成者:
M. Ranganathan
This code is in the public domain.
関連項目:
直列化された形式

メソッドの概要
 java.lang.Object clone()
          Make a clone of this object.
 java.lang.String debugDump()
          Generic print formatting function: Does depth-first descent of the structure and recursively prints all non-private objects pointed to by this object.
 java.lang.String debugDump(int indent)
          Formatter with a given starting indentation.
abstract  java.lang.String encode()
          Get the string encoded version of this object
 boolean equals(java.lang.Object that)
          An introspection based equality predicate for GenericObjects.
static java.lang.Class getClassFromName(java.lang.String className)
           
 Match getMatcher()
          Return the match expression.
static boolean isMySubclass(java.lang.Class other)
           
 boolean match(java.lang.Object other)
          An introspection based predicate matching using a template object.
 void merge(java.lang.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(java.lang.String objectText, GenericObject replacement, boolean matchSubstring)
          Do a recursive find and replace of objects pointed to by this object.
 void replace(java.lang.String objectText, GenericObjectList replacement, boolean matchSubstring)
          Do a recursive find and replace of objects pointed to by this object.
 void setMatcher(Match matchExpression)
          Set the pattern matcher.
 
クラス java.lang.Object から継承されたメソッド
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

メソッドの詳細

setMatcher

public void setMatcher(Match matchExpression)
Set the pattern matcher. To match on the field of a sip message, set the match expression in the match template and invoke the match function. This useful because SIP headers and parameters may appear in different orders and are not necessarily in canonical form. This makes it hard to write a pattern matcher that relies on regular expressions alone. Thus we rely on the following strategy i.e. To do pattern matching on an incoming message, first parse it, and then construct a match template, filling in the fields that you want to match. The rules for matching are: A null object matches wild card - that is a match template of null matches any parsed SIP object. To match with any subfield, set the match template on a template object of the same type and invoke the match interface. Regular expressions matching implements the gov.nist.sip.Match interface that can be done using the Jakarta regexp package for example. package included herein. This can be used to implement the Match interface See the APACHE website for documents


getMatcher

public Match getMatcher()
Return the match expression.

戻り値:
the match expression that has previously been set.

getClassFromName

public static java.lang.Class getClassFromName(java.lang.String className)

isMySubclass

public static boolean isMySubclass(java.lang.Class other)

clone

public java.lang.Object clone()
Make a clone of this object.

オーバーライド:
クラス java.lang.Object 内の clone

merge

public void merge(java.lang.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.

パラメータ:
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.

equals

public boolean equals(java.lang.Object that)
An introspection based equality predicate for GenericObjects.

オーバーライド:
クラス java.lang.Object 内の equals
パラメータ:
that - is the other object to test against.
戻り値:
true if the objects are euqal and false otherwise

match

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

パラメータ:
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.

debugDump

public java.lang.String debugDump()
Generic print formatting function: Does depth-first descent of the structure and recursively prints all non-private objects pointed to by this object. Warning - the following generic string routine will bomb (go into infinite loop) if there are any circularly linked structures so if you have these, they had better be private! We dont have to worry about such things for our structures (we never use circular linked structures).


debugDump

public java.lang.String debugDump(int indent)
Formatter with a given starting indentation.


encode

public abstract java.lang.String encode()
Get the string encoded version of this object

導入されたバージョン:
v1.0

replace

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

パラメータ:
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 (a substring if matchSubstring is true) as objectText and with the same class as replacement.
例外:
java.lang.IllegalArgumentException
導入されたバージョン:
v1.0

replace

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

パラメータ:
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 a match of the encoded text with objectText and with the same class as replacement.
matchSubstring - is true if we want to match objectText as a substring of the encoded target text. (i.e. 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.)
例外:
java.lang.IllegalArgumentException
導入されたバージョン:
v1.0

replace

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

パラメータ:
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.
例外:
java.lang.IllegalArgumentException
導入されたバージョン:
v1.0

replace

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

パラメータ:
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.
例外:
java.lang.IllegalArgumentException