Class AttributeListUtils
java.lang.Object
com.sun.enterprise.admin.util.jmx.AttributeListUtils
A class that has some useful utility methods to deal with
- Jmx Attributes
- Jmx AttributeLists.
- Since:
- Sun Java System Application Server 8
- Author:
- Kedar.Mhaswade@Sun.Com
-
Method Summary
Modifier and TypeMethodDescriptionstatic MapReturns the given list as a map of attributes, keyed on the names of the attribute in the list.static booleancontainsNamedAttribute(AttributeList al, String name) Checks whether this list contains a JMXAttributewith given name.static booleanChecks whether an attribute with the name same as that of the given attribute exists in this list.static Stringdash2CamelCase(String dashed) static StringtoJmx12Attribute(String name) JMX 1.2 specification had a weird limitation that a Dynamic MBean may not have an attribute whose name is not a valid Java identifier .static StringReturns a String representation of an attribute list such that: Each attribute is a name and value separated by a ','.
-
Method Details
-
containsNamedAttribute
Checks whether this list contains a JMXAttributewith given name. Note that this method will return true if there is at least one attribute with given name.- Parameters:
al- an instance ofAttributeListname- a String representing the name of the attribute. The name may not be null.- Returns:
- true if there is at least one attribute in the list with given name, false otherwise
- Throws:
IllegalArgumentException- if the attribute list or name is null
-
containsNamedAttribute
Checks whether an attribute with the name same as that of the given attribute exists in this list. The given name may not be null.- Parameters:
al- an instance ofAttributeLista- an Attribute with a name and a value- Returns:
- true if there exists at least one attribute with same name, false otherwise
- Throws:
IllegalArgumentException- if the attribute list or name is null
-
asNameMap
Returns the given list as a map of attributes, keyed on the names of the attribute in the list. The passed argument may not be null. The mappings are between the names of attributes and attributes themselves.- Parameters:
al- the list of attributes that need to be mapped- Returns:
- an instance of
Map - Throws:
IllegalArgumentException- if the argument is null
-
toJmx12Attribute
JMX 1.2 specification had a weird limitation that a Dynamic MBean may not have an attribute whose name is not a valid Java identifier . This method is a utility method to convert the any arbitrary name into a String that can be a valid JMX 1.2 attribute. Every character in the string passed that is neither a Character.isJavaIdentifierStart nor a Character.isJavaIdentifierPart is replace with a valid character '_'.- Parameters:
name- a String that represents any non null name- Returns:
- a String that represents a name valid for a JMX 1.2 MBean.
- Throws:
IllegalArgumentException- if the parameter is null or is of zero length
-
toString
Returns a String representation of an attribute list such that:- Each attribute is a name and value separated by a ','. toString() on the value is called.
- Each pair is separated by a new line character '\n'.
- Parameters:
al- the list of attributes - may be null, in which case an empty String is returned.- Returns:
- a String representing the parameter passed
-
dash2CamelCase
-