jdk/test/javax/management/mxbean/SqeParameter.java
changeset 34827 de746e7eb1e3
equal deleted inserted replaced
34826:4bbdce2630f8 34827:de746e7eb1e3
       
     1 /*
       
     2  * Copyright (c) 2005, 2015, 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.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 import java.io.Serializable;
       
    25 
       
    26 /**
       
    27  * That class is to use as an MBean operation parameter or returned value.
       
    28  * The property Glop with its public getter + setter is only there to be
       
    29  * reconstructible following MXBean specification, so that SqeParameter can be
       
    30  * used for what it is designed to.
       
    31  */
       
    32 public class SqeParameter implements Serializable {
       
    33 
       
    34     private static boolean weird;
       
    35     private String glop;
       
    36 
       
    37     static {
       
    38         if ( System.getProperty("WEIRD_PARAM") != null ) {
       
    39             weird = true;
       
    40         }
       
    41     }
       
    42 
       
    43     /**
       
    44      * Creates a new instance of SqeParameter.
       
    45      * <br>When the Java property WEIRD_PARAM is set, that constructor
       
    46      * throws an exception.
       
    47      * <br>That can be used to ensure the class is instantiated on server side
       
    48      * but never on client side.
       
    49      */
       
    50     public SqeParameter() throws Exception {
       
    51         if ( weird ) {
       
    52             throw new Exception();
       
    53         }
       
    54     }
       
    55 
       
    56     public String getGlop() {
       
    57         return glop;
       
    58     }
       
    59 
       
    60     public void setGlop(String value) {
       
    61         glop = value;
       
    62     }
       
    63 }