1 /*
2 * Copyright (c) 2000, 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. 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
47 import com.sun.jmx.remote.util.EnvHelp;
48 import sun.reflect.misc.MethodUtil;
49 import sun.reflect.misc.ReflectUtil;
50
51 /**
52 * Describes an attribute of an open MBean.
53 *
54 *
55 * @since 1.5
56 */
57 public class OpenMBeanAttributeInfoSupport
58 extends MBeanAttributeInfo
59 implements OpenMBeanAttributeInfo {
60
61 /* Serial version */
62 static final long serialVersionUID = -4867215622149721849L;
63
64 /**
65 * @serial The open mbean attribute's <i>open type</i>
66 */
67 private OpenType<?> openType;
68
69 /**
70 * @serial The open mbean attribute's default value
71 */
72 private final Object defaultValue;
73
74 /**
75 * @serial The open mbean attribute's legal values. This {@link
76 * Set} is unmodifiable
77 */
78 private final Set<?> legalValues; // to be constructed unmodifiable
79
80 /**
81 * @serial The open mbean attribute's min value
82 */
83 private final Comparable<?> minValue;
84
85 /**
86 * @serial The open mbean attribute's max value
87 */
88 private final Comparable<?> maxValue;
89
90
91 // As this instance is immutable, these two values need only
92 // be calculated once.
93 private transient Integer myHashCode = null;
94 private transient String myToString = null;
95
96
97 /**
98 * Constructs an {@code OpenMBeanAttributeInfoSupport} instance,
99 * which describes the attribute of an open MBean with the
100 * specified {@code name}, {@code openType} and {@code
101 * description}, and the specified read/write access properties.
102 *
103 * @param name cannot be a null or empty string.
104 *
105 * @param description cannot be a null or empty string.
106 *
107 * @param openType cannot be null.
|
1 /*
2 * Copyright (c) 2000, 2019, 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
47 import com.sun.jmx.remote.util.EnvHelp;
48 import sun.reflect.misc.MethodUtil;
49 import sun.reflect.misc.ReflectUtil;
50
51 /**
52 * Describes an attribute of an open MBean.
53 *
54 *
55 * @since 1.5
56 */
57 public class OpenMBeanAttributeInfoSupport
58 extends MBeanAttributeInfo
59 implements OpenMBeanAttributeInfo {
60
61 /* Serial version */
62 static final long serialVersionUID = -4867215622149721849L;
63
64 /**
65 * @serial The open mbean attribute's <i>open type</i>
66 */
67 @SuppressWarnings("serial") // Not statically typed as Serializable
68 private OpenType<?> openType;
69
70 /**
71 * @serial The open mbean attribute's default value
72 */
73 @SuppressWarnings("serial") // Not statically typed as Serializable
74 private final Object defaultValue;
75
76 /**
77 * @serial The open mbean attribute's legal values. This {@link
78 * Set} is unmodifiable
79 */
80 @SuppressWarnings("serial") // Conditionally serializable
81 private final Set<?> legalValues; // to be constructed unmodifiable
82
83 /**
84 * @serial The open mbean attribute's min value
85 */
86 @SuppressWarnings("serial") // Conditionally serializable
87 private final Comparable<?> minValue;
88
89 /**
90 * @serial The open mbean attribute's max value
91 */
92 @SuppressWarnings("serial") // Conditionally serializable
93 private final Comparable<?> maxValue;
94
95
96 // As this instance is immutable, these two values need only
97 // be calculated once.
98 private transient Integer myHashCode = null;
99 private transient String myToString = null;
100
101
102 /**
103 * Constructs an {@code OpenMBeanAttributeInfoSupport} instance,
104 * which describes the attribute of an open MBean with the
105 * specified {@code name}, {@code openType} and {@code
106 * description}, and the specified read/write access properties.
107 *
108 * @param name cannot be a null or empty string.
109 *
110 * @param description cannot be a null or empty string.
111 *
112 * @param openType cannot be null.
|