|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.util.JBossObject
public class JBossObject
Utility Class Utility Class that provides a Logger instance (log) and caching of toString() and hashCode() values. You most probably want to override the method that comes from JBossInterface: public void toShortString(StringBuffer buffer) to append to the buffer the key class properties, and also override the following methods to provide the hashCode and the class properties that should be cached: protected void toString(StringBuffer buffer) protected int getHashCode() Cached values can be flushed using flushJBossObjectCache() Caching can be disabled by simply overriding toString() and hashCode(), or returning false from methods: protected boolean cacheToString() protected boolean cacheGetHashCode()
Field Summary | |
---|---|
protected int |
hashCode
Cached hashCode |
protected Logger |
log
The log |
protected SoftReference |
toString
Cached toString |
Constructor Summary | |
---|---|
JBossObject()
Create a new object |
|
JBossObject(Logger log)
Create a new object using the specified Logger instace |
Method Summary | |
---|---|
protected boolean |
cacheGetHashCode()
Whether we should cache the result hashCode() |
protected boolean |
cacheToString()
Whether we should cache the result toString() |
Object |
clone()
Clone the object |
static boolean |
equals(Object one,
Object two)
Safe equality check |
protected void |
flushJBossObjectCache()
Flush the JBossObject cached values |
String |
getClassShortName()
Get the class short name |
protected int |
getHashCode()
Calculate the hashcode |
int |
hashCode()
Override hashCode to cache the value |
static void |
list(JBossStringBuilder buffer,
Collection objects)
List the set of JBossObjects |
static boolean |
notEqual(Object one,
Object two)
Safe inequality check |
String |
toShortString()
Print a short version of the object |
void |
toShortString(JBossStringBuilder buffer)
Append the key class properties to the buffer |
String |
toString()
Override toString to cache the value |
protected void |
toString(JBossStringBuilder buffer)
Append the class properties to the buffer |
protected String |
toStringImplementation()
Implementation of String |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Logger log
protected transient SoftReference toString
protected transient int hashCode
Constructor Detail |
---|
public JBossObject()
public JBossObject(Logger log)
log
- the Logger instance to useMethod Detail |
---|
public static boolean equals(Object one, Object two)
one
- an objecttwo
- another objectpublic static boolean notEqual(Object one, Object two)
one
- an objecttwo
- another objectpublic static void list(JBossStringBuilder buffer, Collection objects)
buffer
- the bufferobjects
- the collection of objectspublic String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public Object clone()
JBossInterface
clone
in interface JBossInterface
clone
in class Object
public String toShortString()
JBossInterface
toShortString
in interface JBossInterface
public void toShortString(JBossStringBuilder buffer)
toShortString
in interface JBossInterface
buffer
- the bufferpublic String getClassShortName()
protected String toStringImplementation()
protected void flushJBossObjectCache()
protected void toString(JBossStringBuilder buffer)
buffer
- the bufferprotected int getHashCode()
protected boolean cacheToString()
protected boolean cacheGetHashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |