com.sun.enterprise.admin.util.jmx
Class AttributeListUtils

java.lang.Object
  extended by com.sun.enterprise.admin.util.jmx.AttributeListUtils

public class AttributeListUtils
extends java.lang.Object

A class that has some useful utility methods to deal with

It is expected to enhance this class with more utility methods.

Since:
Sun Java System Application Server 8
Author:
Kedar.Mhaswade@Sun.Com

Method Summary
static java.util.Map asNameMap(javax.management.AttributeList al)
          Returns the given list as a map of attributes, keyed on the names of the attribute in the list.
static boolean containsNamedAttribute(javax.management.AttributeList al, javax.management.Attribute a)
          Checks whether an attribute with the name same as that of the given attribute exists in this list.
static boolean containsNamedAttribute(javax.management.AttributeList al, java.lang.String name)
          Checks whether this list contains a JMX Attribute with given name.
static java.lang.String dash2CamelCase(java.lang.String dashed)
           
static java.lang.String toJmx12Attribute(java.lang.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 java.lang.String toString(javax.management.AttributeList al)
          Returns a String representation of an attribute list such that: Each attribute is a name and value separated by a ','.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

containsNamedAttribute

public static final boolean containsNamedAttribute(javax.management.AttributeList al,
                                                   java.lang.String name)
Checks whether this list contains a JMX Attribute with given name. Note that this method will return true if there is at least one attribute with given name.

Parameters:
al - an instance of AttributeList
name - 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:
java.lang.IllegalArgumentException - if the attribute list or name is null

containsNamedAttribute

public static final boolean containsNamedAttribute(javax.management.AttributeList al,
                                                   javax.management.Attribute a)
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 of AttributeList
a - an Attribute with a name and a value
Returns:
true if there exists at least one attribute with same name, false otherwise
Throws:
java.lang.IllegalArgumentException - if the attribute list or name is null

asNameMap

public static final java.util.Map asNameMap(javax.management.AttributeList al)
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:
java.lang.IllegalArgumentException - if the argument is null

toJmx12Attribute

public static final java.lang.String toJmx12Attribute(java.lang.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 . 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:
java.lang.IllegalArgumentException - if the parameter is null or is of zero length

toString

public static final java.lang.String toString(javax.management.AttributeList al)
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

public static java.lang.String dash2CamelCase(java.lang.String dashed)


Copyright © 2012 GlassFish Community. All Rights Reserved.