|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwt.jmx.core.AttributeListWrapper
public abstract class AttributeListWrapper
Wraps a JMX AttributeList so as to provide better toString() behaviors for use in logging, etc, and to provide an easily identifiable type for use with custom log4j renderers.
This class' toString() will either output in a default format unless provided
with a non-null, non-empty Formatter formatString, in which
case it will use it.
Supported API: true
Extendable: true
| Method Summary | |
|---|---|
void |
clearCaches()
Clear attribute list and string rep caches. |
void |
clearStringRepCache()
Clear string rep cache. |
protected abstract AttributeList |
computeAttributeList()
Method used by getAttributeList() to compute attribute list when needed, as governed by isCaching(). |
protected String |
computeStringRep()
Method used by toString() to compute string representation when needed, as governed by isCaching(). |
static String |
defaultRenderObjectAsString(Object obj)
Render the given object to a String. |
static String |
getActualSeparator(String separator)
setSeparator() will not accept certain separators, e.g. |
AttributeList |
getAttributeList()
Method used by toString() [or a custom log4j renderer] to get attribute list when needed. |
static String |
getDefaultSeparator()
Default value of separator property. |
String |
getFormatString()
Returns format string specified for use with Formatter. |
static String[] |
getNamesOfReadableAttributes(MBeanInfo mbeanInfo)
Get list of all of the readable attributes from an MBeanInfo. |
static Map<String,Object> |
getReadableProperties(Object bean)
Get names of readable properties and their values from regular Java bean |
static Map<String,Object> |
getReadableProperties(Object bean,
Class stopClass)
Get names of readable properties and their values from regular Java bean. |
String |
getSeparator()
Returns separator string used by default format (i.e. |
boolean |
isCaching()
Returns whether first result of computeAttributeList() and computeStringRep() will be cached or be called again on each call of getAttributeList() and toString(), respectively. |
boolean |
isShortFormat()
Returns true if attribute names are included by default format (i.e. |
static AttributeListWrapper |
newInstance(AttributeList attributeList)
Get instance wrapping given attribute list. |
static AttributeListWrapper |
newInstance(DynamicMBean mbean,
String[] attributeNames)
Get instance wrapping which will produce an attribute list from the given MBean as needed containing the named attributes. |
static AttributeListWrapper |
newInstance(Map<String,?> attrMap,
String[] attributeNames)
Get instance wrapping which will produce an attribute list containing the attributes from attrMap specified by attributeNames -- or all attributes from attrMap if attributeNames is null. |
static AttributeListWrapper |
newInstance(MBeanServerConnection mbeanServer,
ObjectName objectName)
Get instance wrapping which will produce an attribute list from the given MBean as needed. |
void |
setCaching(boolean caching)
Sets whether first result of computeAttributeList() and computeStringRep() will be cached or be called again on each call of getAttributeList() and toString(), respectively. |
void |
setFormatString(String formatString)
Sets format string specified for use with Formatter; when
this is null Formatter is not used. |
void |
setSeparator(String separator)
Sets separator string used by default format (i.e. |
void |
setShortFormat(boolean shortFormat)
Sets whether attribute names are included by default format (i.e. |
String |
toString()
Renders the attribute list returned by getAttributeList() as a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static String getDefaultSeparator()
public static AttributeListWrapper newInstance(AttributeList attributeList)
public static AttributeListWrapper newInstance(Map<String,?> attrMap,
String[] attributeNames)
public static AttributeListWrapper newInstance(DynamicMBean mbean,
String[] attributeNames)
public static AttributeListWrapper newInstance(MBeanServerConnection mbeanServer,
ObjectName objectName)
public final AttributeList getAttributeList()
protected abstract AttributeList computeAttributeList()
Subclasses must override this method.
Supported API: true
public final String getFormatString()
Formatter.
public final void setFormatString(String formatString)
Formatter; when
this is null Formatter is not used.
public final boolean isShortFormat()
public final void setShortFormat(boolean shortFormat)
public final String getSeparator()
public final void setSeparator(String separator)
public final boolean isCaching()
Note that the caching mechanism does not use synchronization, locking, or volatiles to
absolutely ensure only one invocation of each method. Rather the caching strategy
makes a best effort to avoid multiple calls while avoiding additional bottlenecks.
Supported API: true
public final void setCaching(boolean caching)
Note that the caching mechanism does not use synchronization, locking, or volatiles to
absolutely ensure only one invocation of each method. Rather the caching strategy
makes a best effort to avoid multiple calls while avoiding additional bottlenecks.
Supported API: true
public final void clearCaches()
public final void clearStringRepCache()
public static String getActualSeparator(String separator)
public String toString()
Subclasses can override this method, but should override computeStringRep()
instead unless they wish to alter the caching behavior.
Supported API: true
toString in class Objectprotected String computeStringRep()
Subclasses can override this method.
Supported API: true
public static String defaultRenderObjectAsString(Object obj)
public static String[] getNamesOfReadableAttributes(MBeanInfo mbeanInfo)
public static Map<String,Object> getReadableProperties(Object bean)
bean - Object to introspect for Java Beans properties
public static Map<String,Object> getReadableProperties(Object bean,
Class stopClass)
bean - Object to introspect for Java Beans propertiesstopClass - The baseclass at which to stop the analysis. Any methods/properties/events in the stopClass or in its baseclasses will be ignored in the analysis.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||