1 /*
2 * Copyright (c) 2000, 2008, 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
45
46
47 /**
48 * The {@code CompositeDataSupport} class is the <i>open data</i> class which
49 * implements the {@code CompositeData} interface.
50 *
51 *
52 * @since 1.5
53 */
54 public class CompositeDataSupport
55 implements CompositeData, Serializable {
56
57 /* Serial version */
58 static final long serialVersionUID = 8003518976613702244L;
59
60 /**
61 * @serial Internal representation of the mapping of item names to their
62 * respective values.
63 * A {@link SortedMap} is used for faster retrieval of elements.
64 */
65 private final SortedMap<String, Object> contents;
66
67 /**
68 * @serial The <i>composite type </i> of this <i>composite data</i> instance.
69 */
70 private final CompositeType compositeType;
71
72 /**
73 * <p>Constructs a {@code CompositeDataSupport} instance with the specified
74 * {@code compositeType}, whose item values
75 * are specified by {@code itemValues[]}, in the same order as in
76 * {@code itemNames[]}.
77 * As a {@code CompositeType} does not specify any order on its items,
78 * the {@code itemNames[]} parameter is used
79 * to specify the order in which the values are given in {@code itemValues[]}.
80 * The items contained in this {@code CompositeDataSupport} instance are
81 * internally stored in a {@code TreeMap},
82 * thus sorted in ascending lexicographic order of their names, for faster
83 * retrieval of individual item values.</p>
84 *
|
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
45
46
47 /**
48 * The {@code CompositeDataSupport} class is the <i>open data</i> class which
49 * implements the {@code CompositeData} interface.
50 *
51 *
52 * @since 1.5
53 */
54 public class CompositeDataSupport
55 implements CompositeData, Serializable {
56
57 /* Serial version */
58 static final long serialVersionUID = 8003518976613702244L;
59
60 /**
61 * @serial Internal representation of the mapping of item names to their
62 * respective values.
63 * A {@link SortedMap} is used for faster retrieval of elements.
64 */
65 @SuppressWarnings("serial") // Conditionally serializable
66 private final SortedMap<String, Object> contents;
67
68 /**
69 * @serial The <i>composite type </i> of this <i>composite data</i> instance.
70 */
71 private final CompositeType compositeType;
72
73 /**
74 * <p>Constructs a {@code CompositeDataSupport} instance with the specified
75 * {@code compositeType}, whose item values
76 * are specified by {@code itemValues[]}, in the same order as in
77 * {@code itemNames[]}.
78 * As a {@code CompositeType} does not specify any order on its items,
79 * the {@code itemNames[]} parameter is used
80 * to specify the order in which the values are given in {@code itemValues[]}.
81 * The items contained in this {@code CompositeDataSupport} instance are
82 * internally stored in a {@code TreeMap},
83 * thus sorted in ascending lexicographic order of their names, for faster
84 * retrieval of individual item values.</p>
85 *
|