|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.lastbamboo.common.sdp.GenericObject
public abstract class GenericObject
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.
| Field Summary | |
|---|---|
protected static String |
AND
|
protected static String |
AT
|
protected static String |
COLON
|
protected static String |
COMMA
|
protected static String |
DOT
|
protected static String |
DOUBLE_QUOTE
|
protected static String |
EQUALS
|
protected static String |
GREATER_THAN
|
protected static String |
HT
|
protected static Set |
immutableClasses
|
protected static String[] |
immutableClassNames
|
protected int |
indentation
|
protected static String |
LESS_THAN
|
protected static String |
LPAREN
|
protected Match |
matchExpression
|
protected static String |
NEWLINE
|
protected static String |
PERCENT
|
protected static String |
POUND
|
protected static String |
QUESTION
|
protected static String |
QUOTE
|
protected static String |
RETURN
|
protected static String |
RPAREN
|
protected static String |
SEMICOLON
|
protected static String |
SLASH
|
protected static String |
SP
|
protected static String |
STAR
|
protected String |
stringRepresentation
|
| Constructor Summary | |
|---|---|
protected |
GenericObject()
|
| Method Summary | |
|---|---|
protected void |
Assert(boolean condition,
String msg)
An assertion checking utility. |
Object |
clone()
Clones this object. |
protected void |
dbgPrint()
Debug printing function. |
protected void |
dbgPrint(String s)
Debug printing function. |
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. |
String |
debugDump(int indent)
Formatter with a given starting indentation. |
abstract String |
encode()
Get the string encoded version of this object |
boolean |
equals(Object that)
An introspection based equality predicate for GenericObjects. |
protected String |
getIndentation()
|
Match |
getMatcher()
Return the match expression. |
static boolean |
isMySubclass(Class other)
|
static Object |
makeClone(Object obj)
Clones the given object. |
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 recursive find and replace of objects pointed to by this object. |
void |
replace(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. |
protected void |
sprint(boolean booleanField)
Pretty printing accumulator function for booleans |
protected void |
sprint(char charField)
Pretty printing accumulator function for chars |
protected void |
sprint(double doubleField)
Pretty printing accumulator function for doubles |
protected void |
sprint(float floatField)
Pretty printing accumulator function for floats |
protected void |
sprint(int intField)
Pretty printing accumulator function for ints |
protected void |
sprint(long longField)
Pretty printing accumulator function for longs |
protected void |
sprint(Object o)
Pretty printing function accumulator for objects. |
protected void |
sprint(short shortField)
Pretty printing accumulator function for shorts |
protected void |
sprint(String a)
Add a new string to the accumulated string representation. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String SEMICOLON
protected static final String COLON
protected static final String COMMA
protected static final String SLASH
protected static final String SP
protected static final String EQUALS
protected static final String STAR
protected static final String NEWLINE
protected static final String RETURN
protected static final String LESS_THAN
protected static final String GREATER_THAN
protected static final String AT
protected static final String DOT
protected static final String QUESTION
protected static final String POUND
protected static final String AND
protected static final String LPAREN
protected static final String RPAREN
protected static final String DOUBLE_QUOTE
protected static final String QUOTE
protected static final String HT
protected static final String PERCENT
protected static final Set immutableClasses
protected static final String[] immutableClassNames
protected int indentation
protected String stringRepresentation
protected Match matchExpression
| Constructor Detail |
|---|
protected GenericObject()
| Method Detail |
|---|
public void setMatcher(Match matchExpression)
public Match getMatcher()
public static boolean isMySubclass(Class other)
public static Object makeClone(Object obj)
public Object clone()
clone in class Objectpublic void merge(Object mergeObject)
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.protected String getIndentation()
protected void sprint(String a)
protected void sprint(Object o)
protected void sprint(int intField)
protected void sprint(short shortField)
protected void sprint(char charField)
protected void sprint(long longField)
protected void sprint(boolean booleanField)
protected void sprint(double doubleField)
protected void sprint(float floatField)
protected void dbgPrint()
protected void dbgPrint(String s)
public boolean equals(Object that)
equals in class Objectthat - is the other object to test against.
public boolean match(Object other)
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.public String debugDump()
public String debugDump(int indent)
protected void Assert(boolean condition,
String msg)
public abstract String encode()
public void replace(String objectText,
GenericObject replacement,
boolean matchSubstring)
throws IllegalArgumentException
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.
IllegalArgumentException
public void replace(String objectText,
GenericObjectList replacement,
boolean matchSubstring)
throws IllegalArgumentException
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.)
IllegalArgumentException
public void replace(Match regexp,
GenericObjectList replacement)
throws IllegalArgumentException
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
public void replace(Match regexp,
GenericObject replacement)
throws IllegalArgumentException
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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||