1 /*
   2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.management;
  27 
  28 import java.beans.ConstructorProperties;
  29 import java.util.List;
  30 
  31 /**
  32  * Diagnostic command information. It contains the description of a
  33  * diagnostic command.
  34  *
  35  * @author  Frederic Parain
  36  * @since   7u4
  37  */
  38 
  39 public class DiagnosticCommandInfo {
  40     private final String name;
  41     private final String description;
  42     private final String impact;
  43     private final boolean enabled;
  44     private final List<DiagnosticCommandArgumentInfo> arguments;
  45 
  46     /**
  47      * Returns the diagnostic command name
  48      *
  49      * @return the diagnostic command name
  50      */
  51     public String getName() {
  52         return name;
  53     }
  54 
  55    /**
  56      * Returns the diagnostic command description
  57      *
  58      * @return the diagnostic command description
  59      */
  60     public String getDescription() {
  61         return description;
  62     }
  63 
  64      /**
  65      * Returns the potential impact of the diagnostic command execution
  66      *         on the Java virtual machine behavior
  67      *
  68      * @return the potential impact of the diagnostic command execution
  69      *         on the Java virtual machine behavior
  70      */
  71     public String getImpact() {
  72         return impact;
  73     }
  74 
  75     /**
  76      * Returns {@code true} if the diagnostic command is enabled,
  77      *         {@code false} otherwise. The enabled/disabled
  78      *         status of a diagnostic command can evolve during
  79      *         the lifetime of the Java virtual machine.
  80      *
  81      * @return {@code true} if the diagnostic command is enabled,
  82      *         {@code false} otherwise
  83      */
  84     public boolean isEnabled() {
  85         return enabled;
  86     }
  87 
  88     /**
  89      * Returns the a list of the diagnostic command arguments description.
  90      * If the diagnostic command has no arguments, it returns an empty list.
  91      *
  92      * @return a list of the diagnostic command arguments description
  93      */
  94     public List<DiagnosticCommandArgumentInfo> getArgumentsInfo() {
  95         return arguments;
  96     }
  97 
  98     @ConstructorProperties({"name", "description","impact","enabled",
  99                 "argumentsInfo"})
 100     public DiagnosticCommandInfo(String name, String description,
 101                                  String impact, boolean enabled,
 102                                  List<DiagnosticCommandArgumentInfo> arguments)
 103     {
 104         this.name = name;
 105         this.description = description;
 106         this.impact = impact;
 107         this.enabled = enabled;
 108         this.arguments = arguments;
 109     }
 110 }