KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orbutil > LegacyHookPutFields


1 /*
2  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 /*
7  * @(#)LegacyHookPutFields.java 1.5 03/12/19
8  */

9 package com.sun.corba.se.impl.orbutil;
10
11 import java.io.*;
12 import java.util.Hashtable JavaDoc;
13
14 /**
15  * Since ObjectOutputStream.PutField methods specify no exceptions,
16  * we are not checking for null parameters on put methods.
17  */

18 class LegacyHookPutFields extends ObjectOutputStream.PutField
19 {
20     private Hashtable JavaDoc fields = new Hashtable JavaDoc();
21
22     /**
23      * Put the value of the named boolean field into the persistent field.
24      */

25     public void put(String JavaDoc name, boolean value){
26         fields.put(name, new Boolean JavaDoc(value));
27     }
28         
29     /**
30      * Put the value of the named char field into the persistent fields.
31      */

32     public void put(String JavaDoc name, char value){
33         fields.put(name, new Character JavaDoc(value));
34     }
35         
36     /**
37      * Put the value of the named byte field into the persistent fields.
38      */

39     public void put(String JavaDoc name, byte value){
40         fields.put(name, new Byte JavaDoc(value));
41     }
42         
43     /**
44      * Put the value of the named short field into the persistent fields.
45      */

46     public void put(String JavaDoc name, short value){
47         fields.put(name, new Short JavaDoc(value));
48     }
49         
50     /**
51      * Put the value of the named int field into the persistent fields.
52      */

53     public void put(String JavaDoc name, int value){
54         fields.put(name, new Integer JavaDoc(value));
55     }
56         
57     /**
58      * Put the value of the named long field into the persistent fields.
59      */

60     public void put(String JavaDoc name, long value){
61         fields.put(name, new Long JavaDoc(value));
62     }
63         
64     /**
65      * Put the value of the named float field into the persistent fields.
66      *
67      */

68     public void put(String JavaDoc name, float value){
69         fields.put(name, new Float JavaDoc(value));
70     }
71         
72     /**
73      * Put the value of the named double field into the persistent field.
74      */

75     public void put(String JavaDoc name, double value){
76         fields.put(name, new Double JavaDoc(value));
77     }
78         
79     /**
80      * Put the value of the named Object field into the persistent field.
81      */

82     public void put(String JavaDoc name, Object JavaDoc value){
83         fields.put(name, value);
84     }
85         
86     /**
87      * Write the data and fields to the specified ObjectOutput stream.
88      */

89     public void write(ObjectOutput out) throws IOException {
90         out.writeObject(fields);
91     }
92 }
93
Popular Tags