FixedHolder.java revision 704:3ef63dbde965
1/*
2 * Copyright (c) 1998, 2001, 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
23 * questions.
24 */
25
26package org.omg.CORBA;
27
28import org.omg.CORBA.portable.Streamable;
29import org.omg.CORBA.portable.InputStream;
30import org.omg.CORBA.portable.OutputStream;
31
32
33/**
34 * The Holder for {@code Fixed}. For more information on
35 * Holder files, see <a href="doc-files/generatedfiles.html#holder">
36 * "Generated Files: Holder Files"</a>.<P>
37 * FixedHolder is a container class for values of IDL type "fixed",
38 * which is mapped to the Java class java.math.BigDecimal.
39 * It is usually used to store "out" and "inout" IDL method parameters.
40 * If an IDL method signature has a fixed as an "out" or "inout" parameter,
41 * the programmer must pass an instance of FixedHolder as the corresponding
42 * parameter in the method invocation; for "inout" parameters, the programmer
43 * must also fill the "in" value to be sent to the server.
44 * Before the method invocation returns, the ORB will fill in the contained
45 * value corresponding to the "out" value returned from the server.
46 *
47 */
48public final class FixedHolder implements Streamable {
49    /**
50     * The value held by the FixedHolder
51     */
52    public java.math.BigDecimal value;
53
54    /**
55     * Construct the FixedHolder without initializing the contained value.
56     */
57    public FixedHolder() {
58    }
59
60    /**
61     * Construct the FixedHolder and initialize it with the given value.
62     * @param initial the value used to initialize the FixedHolder
63     */
64    public FixedHolder(java.math.BigDecimal initial) {
65        value = initial;
66    }
67
68    /**
69     * Read a fixed point value from the input stream and store it in
70     * the value member.
71     *
72     * @param input the {@code InputStream} to read from.
73     */
74    public void _read(InputStream input) {
75        value = input.read_fixed();
76    }
77
78    /**
79     * Write the fixed point value stored in this holder to an
80     * {@code OutputStream}.
81     *
82     * @param output the {@code OutputStream} to write into.
83     */
84    public void _write(OutputStream output) {
85        output.write_fixed(value);
86    }
87
88
89    /**
90     * Return the {@code TypeCode} of this holder object.
91     *
92     * @return the {@code TypeCode} object.
93     */
94    public org.omg.CORBA.TypeCode _type() {
95        return ORB.init().get_primitive_tc(TCKind.tk_fixed);
96    }
97
98}
99