src/java.management/share/classes/javax/management/MBeanPermission.java

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


 438     public MBeanPermission(String className,
 439                            String member,
 440                            ObjectName objectName,
 441                            String actions) {
 442 
 443         super(makeName(className, member, objectName));
 444         initName(className, member, objectName);
 445 
 446         this.actions = actions;
 447         parseActions();
 448     }
 449 
 450     private static String makeName(String className, String member,
 451                                    ObjectName objectName) {
 452         final StringBuilder name = new StringBuilder();
 453         if (className == null)
 454             className = "-";
 455         name.append(className);
 456         if (member == null)
 457             member = "-";
 458         name.append("#" + member);
 459         if (objectName == null)
 460             name.append("[-]");
 461         else
 462             name.append("[").append(objectName.getCanonicalName()).append("]");
 463 
 464         /* In the interests of legibility for Permission.toString(), we
 465            transform the empty string into "*".  */
 466         if (name.length() == 0)
 467             return "*";
 468         else
 469             return name.toString();
 470     }
 471 
 472     /**
 473      * Returns the "canonical string representation" of the actions. That is,
 474      * this method always returns present actions in alphabetical order.
 475      *
 476      * @return the canonical string representation of the actions.
 477      */
 478     public String getActions() {
 479 
 480         if (actions == null)
 481             actions = getActions(this.mask);
 482 




 438     public MBeanPermission(String className,
 439                            String member,
 440                            ObjectName objectName,
 441                            String actions) {
 442 
 443         super(makeName(className, member, objectName));
 444         initName(className, member, objectName);
 445 
 446         this.actions = actions;
 447         parseActions();
 448     }
 449 
 450     private static String makeName(String className, String member,
 451                                    ObjectName objectName) {
 452         final StringBuilder name = new StringBuilder();
 453         if (className == null)
 454             className = "-";
 455         name.append(className);
 456         if (member == null)
 457             member = "-";
 458         name.append('#').append(member);
 459         if (objectName == null)
 460             name.append("[-]");
 461         else
 462             name.append('[').append(objectName.getCanonicalName()).append(']');
 463 
 464         /* In the interests of legibility for Permission.toString(), we
 465            transform the empty string into "*".  */
 466         if (name.length() == 0)
 467             return "*";
 468         else
 469             return name.toString();
 470     }
 471 
 472     /**
 473      * Returns the "canonical string representation" of the actions. That is,
 474      * this method always returns present actions in alphabetical order.
 475      *
 476      * @return the canonical string representation of the actions.
 477      */
 478     public String getActions() {
 479 
 480         if (actions == null)
 481             actions = getActions(this.mask);
 482