1 /*
2 * Copyright (c) 2004, 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
29 import java.util.*;
30 import javax.management.openmbean.ArrayType;
31 import javax.management.openmbean.CompositeData;
32 import javax.management.openmbean.CompositeType;
33 import javax.management.openmbean.OpenType;
34 import javax.management.openmbean.TabularType;
35
36 /**
37 * This abstract class provides the implementation of the CompositeData
38 * interface. A CompositeData object will be lazily created only when
39 * the CompositeData interface is used.
40 *
41 * Classes that extends this abstract class will implement the
42 * getCompositeData() method. The object returned by the
43 * getCompositeData() is an instance of CompositeData such that
44 * the instance serializes itself as the type CompositeDataSupport.
45 */
46 public abstract class LazyCompositeData
47 implements CompositeData, Serializable {
48
49 private CompositeData compositeData;
50
51 // Implementation of the CompositeData interface
52 @Override
53 public boolean containsKey(String key) {
54 return compositeData().containsKey(key);
55 }
56
57 @Override
58 public boolean containsValue(Object value) {
59 return compositeData().containsValue(value);
60 }
61
62 @Override
63 public boolean equals(Object obj) {
64 return compositeData().equals(obj);
65 }
66
67 @Override
68 public Object get(String key) {
|
1 /*
2 * Copyright (c) 2004, 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
29 import java.util.*;
30 import javax.management.openmbean.ArrayType;
31 import javax.management.openmbean.CompositeData;
32 import javax.management.openmbean.CompositeType;
33 import javax.management.openmbean.OpenType;
34 import javax.management.openmbean.TabularType;
35
36 /**
37 * This abstract class provides the implementation of the CompositeData
38 * interface. A CompositeData object will be lazily created only when
39 * the CompositeData interface is used.
40 *
41 * Classes that extends this abstract class will implement the
42 * getCompositeData() method. The object returned by the
43 * getCompositeData() is an instance of CompositeData such that
44 * the instance serializes itself as the type CompositeDataSupport.
45 */
46 public abstract class LazyCompositeData
47 implements CompositeData, Serializable {
48
49 @SuppressWarnings("serial") // Not statically typed as Serializable
50 private CompositeData compositeData;
51
52 // Implementation of the CompositeData interface
53 @Override
54 public boolean containsKey(String key) {
55 return compositeData().containsKey(key);
56 }
57
58 @Override
59 public boolean containsValue(Object value) {
60 return compositeData().containsValue(value);
61 }
62
63 @Override
64 public boolean equals(Object obj) {
65 return compositeData().equals(obj);
66 }
67
68 @Override
69 public Object get(String key) {
|