1 /*
   2  * Copyright (c) 2001, 2002, 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 
  26 /*
  27  */
  28 package com.sun.corba.se.impl.orbutil;
  29 
  30 import java.io.*;
  31 import java.util.Hashtable;
  32 
  33 /**
  34  * Since ObjectOutputStream.PutField methods specify no exceptions,
  35  * we are not checking for null parameters on put methods.
  36  */
  37 class LegacyHookPutFields extends ObjectOutputStream.PutField
  38 {
  39     private Hashtable fields = new Hashtable();
  40 
  41     /**
  42      * Put the value of the named boolean field into the persistent field.
  43      */
  44     public void put(String name, boolean value){
  45         fields.put(name, new Boolean(value));
  46     }
  47 
  48     /**
  49      * Put the value of the named char field into the persistent fields.
  50      */
  51     public void put(String name, char value){
  52         fields.put(name, new Character(value));
  53     }
  54 
  55     /**
  56      * Put the value of the named byte field into the persistent fields.
  57      */
  58     public void put(String name, byte value){
  59         fields.put(name, new Byte(value));
  60     }
  61 
  62     /**
  63      * Put the value of the named short field into the persistent fields.
  64      */
  65     public void put(String name, short value){
  66         fields.put(name, new Short(value));
  67     }
  68 
  69     /**
  70      * Put the value of the named int field into the persistent fields.
  71      */
  72     public void put(String name, int value){
  73         fields.put(name, new Integer(value));
  74     }
  75 
  76     /**
  77      * Put the value of the named long field into the persistent fields.
  78      */
  79     public void put(String name, long value){
  80         fields.put(name, new Long(value));
  81     }
  82 
  83     /**
  84      * Put the value of the named float field into the persistent fields.
  85      *
  86      */
  87     public void put(String name, float value){
  88         fields.put(name, new Float(value));
  89     }
  90 
  91     /**
  92      * Put the value of the named double field into the persistent field.
  93      */
  94     public void put(String name, double value){
  95         fields.put(name, new Double(value));
  96     }
  97 
  98     /**
  99      * Put the value of the named Object field into the persistent field.
 100      */
 101     public void put(String name, Object value){
 102         fields.put(name, value);
 103     }
 104 
 105     /**
 106      * Write the data and fields to the specified ObjectOutput stream.
 107      */
 108     public void write(ObjectOutput out) throws IOException {
 109         out.writeObject(fields);
 110     }
 111 }