javax.management.relation
public class: Role [javadoc |
source]
java.lang.Object
javax.management.relation.Role
All Implemented Interfaces:
java$io$Serializable
Represents a role: includes a role name and referenced MBeans (via their
ObjectNames). The role value is always represented as an ArrayList
collection (of ObjectNames) to homogenize the access.
The serialVersionUID of this class is -279985518429862552L
.
Constructor: |
public Role(String roleName,
List<ObjectName> roleValue) throws IllegalArgumentException {
if (roleName == null || roleValue == null) {
String excMsg = "Invalid parameter";
throw new IllegalArgumentException(excMsg);
}
setRoleName(roleName);
setRoleValue(roleValue);
return;
}
Make a new Role object.
No check is made that the ObjectNames in the role value exist in
an MBean server. That check will be made when the role is set
in a relation.
Parameters:
roleName - role name
roleValue - role value (List of ObjectName objects)
Throws:
IllegalArgumentException - if null parameter
- exception:
IllegalArgumentException - if null parameter
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.management.relation.Role Detail: |
public Object clone() {
try {
return new Role(name, objectNameList);
} catch (IllegalArgumentException exc) {
return null; // can't happen
}
}
|
public String getRoleName() {
return name;
}
|
public List<ObjectName> getRoleValue() {
return objectNameList;
}
|
public static String roleValueToString(List<ObjectName> roleValue) throws IllegalArgumentException {
if (roleValue == null) {
String excMsg = "Invalid parameter";
throw new IllegalArgumentException(excMsg);
}
StringBuilder result = new StringBuilder();
for (ObjectName currObjName : roleValue) {
if (result.length() > 0)
result.append("\n");
result.append(currObjName.toString());
}
return result.toString();
}
Returns a string for the given role value. |
public void setRoleName(String roleName) throws IllegalArgumentException {
if (roleName == null) {
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
name = roleName;
return;
}
|
public void setRoleValue(List<ObjectName> roleValue) throws IllegalArgumentException {
if (roleValue == null) {
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
objectNameList = new ArrayList< ObjectName >(roleValue);
return;
}
|
public String toString() {
StringBuilder result = new StringBuilder();
result.append("role name: " + name + "; role value: ");
for (Iterator< ObjectName > objNameIter = objectNameList.iterator();
objNameIter.hasNext();) {
ObjectName currObjName = objNameIter.next();
result.append(currObjName.toString());
if (objNameIter.hasNext()) {
result.append(", ");
}
}
return result.toString();
}
Returns a string describing the role. |