src/java.management/share/classes/javax/management/relation/Role.java

Print this page
rev 10552 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 209      * @see #getRoleValue
 210      */
 211     public void setRoleValue(List<ObjectName> roleValue)
 212         throws IllegalArgumentException {
 213 
 214         if (roleValue == null) {
 215             String excMsg = "Invalid parameter.";
 216             throw new IllegalArgumentException(excMsg);
 217         }
 218 
 219         objectNameList = new ArrayList<ObjectName>(roleValue);
 220         return;
 221     }
 222 
 223     /**
 224      * Returns a string describing the role.
 225      *
 226      * @return the description of the role.
 227      */
 228     public String toString() {
 229         StringBuilder result = new StringBuilder();
 230         result.append("role name: " + name + "; role value: ");
 231         for (Iterator<ObjectName> objNameIter = objectNameList.iterator();
 232              objNameIter.hasNext();) {
 233             ObjectName currObjName = objNameIter.next();
 234             result.append(currObjName.toString());
 235             if (objNameIter.hasNext()) {
 236                 result.append(", ");
 237             }
 238         }
 239         return result.toString();
 240     }
 241 
 242     //
 243     // Misc
 244     //
 245 
 246     /**
 247      * Clone the role object.
 248      *
 249      * @return a Role that is an independent copy of the current Role object.
 250      */
 251     public Object clone() {
 252 
 253         try {
 254             return new Role(name, objectNameList);
 255         } catch (IllegalArgumentException exc) {
 256             return null; // can't happen
 257         }
 258     }
 259 




 209      * @see #getRoleValue
 210      */
 211     public void setRoleValue(List<ObjectName> roleValue)
 212         throws IllegalArgumentException {
 213 
 214         if (roleValue == null) {
 215             String excMsg = "Invalid parameter.";
 216             throw new IllegalArgumentException(excMsg);
 217         }
 218 
 219         objectNameList = new ArrayList<ObjectName>(roleValue);
 220         return;
 221     }
 222 
 223     /**
 224      * Returns a string describing the role.
 225      *
 226      * @return the description of the role.
 227      */
 228     public String toString() {
 229         StringBuilder sb = new StringBuilder();
 230         sb.append("role name: ").append(name).append("; role value: ");
 231         for (Iterator<ObjectName> objNameIter = objectNameList.iterator(); objNameIter
 232                 .hasNext();) {
 233             ObjectName currObjName = objNameIter.next();
 234             sb.append(currObjName);
 235             if (objNameIter.hasNext()) {
 236                 sb.append(", ");
 237             }
 238         }
 239         return sb.toString();
 240     }
 241 
 242     //
 243     // Misc
 244     //
 245 
 246     /**
 247      * Clone the role object.
 248      *
 249      * @return a Role that is an independent copy of the current Role object.
 250      */
 251     public Object clone() {
 252 
 253         try {
 254             return new Role(name, objectNameList);
 255         } catch (IllegalArgumentException exc) {
 256             return null; // can't happen
 257         }
 258     }
 259