javax.management.relation
Class Role

java.lang.Object
  extended byjavax.management.relation.Role
All Implemented Interfaces:
java.io.Serializable

public class Role
extends java.lang.Object
implements java.io.Serializable

A role is a role name and an ordered list of object names to the MBeans in the role.

See Also:
Serialized Form

Constructor Summary
Role(java.lang.String roleName, java.util.List roleValue)
          Construct a new role.
 
Method Summary
 java.lang.Object clone()
          Clones the object.
 java.lang.String getRoleName()
          Retrieve the role name.
 java.util.List getRoleValue()
          Retrieve the role value.
static java.lang.String roleValueToString(java.util.List roleValue)
          Formats the role value for output.
 void setRoleName(java.lang.String roleName)
          Set the role name.
 void setRoleValue(java.util.List roleValue)
          Set the role value it must be an ArrayList.
 java.lang.String toString()
          Formats the role for output.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Role

public Role(java.lang.String roleName,
            java.util.List roleValue)
     throws java.lang.IllegalArgumentException
Construct a new role.

No validation is performed until the role is set of in a relation. Passed parameters must not be null.

The passed list must be an ArrayList.

Parameters:
roleName - the role name
roleValue - the MBean object names in the role
Throws:
java.lang.IllegalArgumentException - for null values.
Method Detail

roleValueToString

public static java.lang.String roleValueToString(java.util.List roleValue)
                                          throws java.lang.IllegalArgumentException
Formats the role value for output.

The spec says it should be a comma separated list of object names. But the RI uses new lines which makes more sense for object names.

Parameters:
roleValue - the role value to print
Returns:
the string representation
Throws:
java.lang.IllegalArgumentException - for null value.

getRoleName

public java.lang.String getRoleName()
Retrieve the role name.

Returns:
the role name.

getRoleValue

public java.util.List getRoleValue()
Retrieve the role value.

Returns:
a list of MBean object names.

setRoleName

public void setRoleName(java.lang.String roleName)
                 throws java.lang.IllegalArgumentException
Set the role name.

Parameters:
roleName - the role name.
Throws:
java.lang.IllegalArgumentException - for a null value

setRoleValue

public void setRoleValue(java.util.List roleValue)
                  throws java.lang.IllegalArgumentException
Set the role value it must be an ArrayList. A list of mbean object names.

Parameters:
roleValue - the role value.
Throws:
java.lang.IllegalArgumentException - for a null value or not an array list

clone

public java.lang.Object clone()
Clones the object.

Returns:
a copy of the role
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Formats the role for output.

Returns:
a human readable string