FileDocCategorySizeDatePackage
RoleUnresolved.javaAPI DocJava SE 6 API8868Tue Jun 10 00:26:18 BST 2008javax.management.relation

RoleUnresolved

public class RoleUnresolved extends Object implements Serializable
Represents an unresolved role: a role not retrieved from a relation due to a problem. It provides the role name, value (if problem when trying to set the role) and an integer defining the problem (constants defined in RoleStatus).

The serialVersionUID of this class is -48350262537070138L.

since
1.5

Fields Summary
private static final long
oldSerialVersionUID
private static final long
newSerialVersionUID
private static final ObjectStreamField[]
oldSerialPersistentFields
private static final ObjectStreamField[]
newSerialPersistentFields
private static final long
serialVersionUID
private static final ObjectStreamField[]
serialPersistentFields
private static boolean
compat
private String
roleName
private List
roleValue
private int
problemType
Constructors Summary
public RoleUnresolved(String name, List value, int pbType)
Constructor.

param
name name of the role
param
value value of the role (if problem when setting the role)
param
pbType type of problem (according to known problem types, listed as static final members).
exception
IllegalArgumentException if null parameter or incorrect problem type


    //
    // Constructor
    //

                                                        
      
			   
			   
	  

	if (name == null) {
	    String excMsg = "Invalid parameter.";
	    throw new IllegalArgumentException(excMsg);
	}

	setRoleName(name);
	setRoleValue(value);
	// Can throw IllegalArgumentException
	setProblemType(pbType);
	return;
    
Methods Summary
public java.lang.Objectclone()
Clone this object.

return
an independent clone.

	try {
	    return new RoleUnresolved(roleName, roleValue, problemType);
	} catch (IllegalArgumentException exc) {
	    return null; // :)
	}
    
public intgetProblemType()
Retrieves problem type.

return
an integer corresponding to a problem, those being described as static final members of current class.
see
#setProblemType

	return problemType;
    
public java.lang.StringgetRoleName()
Retrieves role name.

return
the role name.
see
#setRoleName

	return roleName;
    
public java.util.ListgetRoleValue()
Retrieves role value.

return
an ArrayList of ObjectName objects, the one provided to be set in given role. Null if the unresolved role is returned for a read access.
see
#setRoleValue

	return roleValue;
    
private voidreadObject(java.io.ObjectInputStream in)
Deserializes a {@link RoleUnresolved} from an {@link ObjectInputStream}.

      if (compat)
      {
        // Read an object serialized in the old serial form
        //
        ObjectInputStream.GetField fields = in.readFields();
	roleName = (String) fields.get("myRoleName", null);
	if (fields.defaulted("myRoleName"))
        {
          throw new NullPointerException("myRoleName");
        }
	roleValue = (List<ObjectName>) fields.get("myRoleValue", null);
	if (fields.defaulted("myRoleValue"))
        {
          throw new NullPointerException("myRoleValue");
        }
	problemType = fields.get("myPbType", (int)0);
	if (fields.defaulted("myPbType"))
        {
          throw new NullPointerException("myPbType");
        }
      }
      else
      {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
      }
    
public voidsetProblemType(int pbType)
Sets problem type.

param
pbType integer corresponding to a problem. Must be one of those described as static final members of current class.
exception
IllegalArgumentException if incorrect problem type
see
#getProblemType


	if (!(RoleStatus.isRoleStatus(pbType))) {
	    String excMsg = "Incorrect problem type.";
	    throw new IllegalArgumentException(excMsg);
	}
	problemType = pbType;
	return;
    
public voidsetRoleName(java.lang.String name)
Sets role name.

param
name the new role name.
exception
IllegalArgumentException if null parameter
see
#getRoleName


	if (name == null) {
	    String excMsg = "Invalid parameter.";
	    throw new IllegalArgumentException(excMsg);
	}

	roleName = name;
	return;
    
public voidsetRoleValue(java.util.List value)
Sets role value.

param
value List of ObjectName objects for referenced MBeans not set in role.
see
#getRoleValue


	if (value != null) {
	    roleValue = new ArrayList<ObjectName>(value);
	} else {
	    roleValue = null;
	}
	return;
    
public java.lang.StringtoString()
Return a string describing this object.

return
a description of this RoleUnresolved object.

	StringBuffer result = new StringBuffer();
	result.append("role name: " + roleName);
	if (roleValue != null) {
	    result.append("; value: ");
	    for (Iterator objNameIter = roleValue.iterator();
		 objNameIter.hasNext();) {
		ObjectName currObjName = (ObjectName)(objNameIter.next());
		result.append(currObjName.toString());
		if (objNameIter.hasNext()) {
		    result.append(", ");
		}
	    }
	}
	result.append("; problem type: " + problemType);
	return result.toString();
    
private voidwriteObject(java.io.ObjectOutputStream out)
Serializes a {@link RoleUnresolved} to an {@link ObjectOutputStream}.

      if (compat)
      {
        // Serializes this instance in the old serial form
        //
        ObjectOutputStream.PutField fields = out.putFields();
	fields.put("myRoleName", roleName);
	fields.put("myRoleValue", (ArrayList)roleValue);
	fields.put("myPbType", problemType);
	out.writeFields();
      }
      else
      {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
      }