jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java
author sjiang
Fri, 17 Apr 2015 09:40:02 +0200
changeset 30355 e37c7eba132f
parent 25859 jdk/src/java.management/share/classes/com/sun/management/VMOption.java@3317bb8137f4
child 30365 551470085a1d
permissions -rw-r--r--
8042901: Allow com.sun.management to be in a different module to java.lang.management Reviewed-by: mchung, dfuchs, erikj, jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
     2
 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
    28
import com.sun.management.internal.VMOptionCompositeData;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.management.openmbean.CompositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Information about a VM option including its value and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * where the value came from which is referred as its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * {@link VMOption.Origin <i>origin</i>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * Each VM option has a default value.  A VM option can
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * be set at VM creation time typically as a command line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * argument to the launcher or an argument passed to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * VM created using the JNI invocation interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * In addition, a VM option may be set via an environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * variable or a configuration file. A VM option can also
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * be set dynamically via a management interface after
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the VM was started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * A <tt>VMOption</tt> contains the value of a VM option
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * and the origin of that value at the time this <tt>VMOption</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * object was constructed.  The value of the VM option
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * may be changed after the <tt>VMOption</tt> object was constructed,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @see <a href="{@docRoot}/../../../../technotes/guides/vm/index.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *         Java Virtual Machine</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 14342
diff changeset
    55
@jdk.Exported
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
public class VMOption {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private String value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private boolean writeable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private Origin origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Origin of the value of a VM option.  It tells where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * value of a VM option came from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 14342
diff changeset
    68
    @jdk.Exported
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public enum Origin {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
         * The VM option has not been set and its value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * is the default value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        DEFAULT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * The VM option was set at VM creation time typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * as a command line argument to the launcher or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         * an argument passed to the VM created using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         * JNI invocation interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        VM_CREATION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         * The VM option was set via an environment variable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        ENVIRON_VAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
         * The VM option was set via a configuration file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        CONFIG_FILE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
         * The VM option was set via the management interface after the VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
         * was started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        MANAGEMENT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         * The VM option was set via the VM ergonomic support.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        ERGONOMIC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        /**
22299
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 20742
diff changeset
   100
         * The VM option was set using the attach framework.
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 20742
diff changeset
   101
         * @since 1.9
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 20742
diff changeset
   102
         */
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 20742
diff changeset
   103
        ATTACH_ON_DEMAND,
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 20742
diff changeset
   104
        /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
         * The VM option was set via some other mechanism.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        OTHER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * Constructs a <tt>VMOption</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @param name Name of a VM option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @param value Value of a VM option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @param writeable <tt>true</tt> if a VM option can be set dynamically,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *                  or <tt>false</tt> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @param origin where the value of a VM option came from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @throws NullPointerException if the name or value is <tt>null</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public VMOption(String name, String value, boolean writeable, Origin origin) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        this.value = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        this.writeable = writeable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        this.origin = origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Constructs a <tt>VMOption</tt> object from a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * {@link CompositeData CompositeData}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    private VMOption(CompositeData cd) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        // validate the input composite data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        VMOptionCompositeData.validateCompositeData(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        this.name = VMOptionCompositeData.getName(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        this.value = VMOptionCompositeData.getValue(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        this.writeable = VMOptionCompositeData.isWriteable(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        this.origin = VMOptionCompositeData.getOrigin(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Returns the name of this VM option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @return the name of this VM option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * Returns the value of this VM option at the time when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * this <tt>VMOption</tt> was created. The value could have been changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @return the value of the VM option at the time when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *         this <tt>VMOption</tt> was created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public String getValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * Returns the origin of the value of this VM option. That is,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * where the value of this VM option came from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @return where the value of this VM option came from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public Origin getOrigin() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        return origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * Tests if this VM option is writeable.  If this VM option is writeable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * it can be set by the {@link HotSpotDiagnosticMXBean#setVMOption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * HotSpotDiagnosticMXBean.setVMOption} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @return <tt>true</tt> if this VM option is writeable; <tt>false</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    public boolean isWriteable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        return writeable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        return "VM option: " + getName() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
               " value: " + value + " " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
               " origin: " + origin + " " +
13794
73e854afd84d 7194597: Typeo in com.sun.management.VMOption.toString()
dsamersoff
parents: 5506
diff changeset
   188
               (writeable ? "(read-write)" : "(read-only)");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Returns a <tt>VMOption</tt> object represented by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * must contain the following attributes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * <table border>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *   <th align=left>Attribute Name</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *   <th align=left>Type</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     *   <td>name</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     *   <td><tt>java.lang.String</tt></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *   <td>value</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *   <td><tt>java.lang.String</tt></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *   <td>origin</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *   <td><tt>java.lang.String</tt></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     *   <td>writeable</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *   <td><tt>java.lang.Boolean</tt></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @param cd <tt>CompositeData</tt> representing a <tt>VMOption</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @throws IllegalArgumentException if <tt>cd</tt> does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *   represent a <tt>VMOption</tt> with the attributes described
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *   above.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * @return a <tt>VMOption</tt> object represented by <tt>cd</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *         if <tt>cd</tt> is not <tt>null</tt>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *         <tt>null</tt> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public static VMOption from(CompositeData cd) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        if (cd == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        if (cd instanceof VMOptionCompositeData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            return ((VMOptionCompositeData) cd).getVMOption();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            return new VMOption(cd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   244
    // for sun.management.MappedMXBeanType
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   245
    static CompositeData toCompositeData(VMOption option) {
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   246
        return VMOptionCompositeData.toCompositeData(option);
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   247
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
}