corba/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java

Print this page
rev 502 : 8000631: Restrict access to class constructor
Reviewed-by: alanb, ahgross
   1 /*
   2  * Copyright (c) 1999, 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


  75         null,           // tk_objref       14
  76         null,           // tk_struct       15
  77         null,           // tk_union        16
  78         null,           // tk_enum         17
  79         null,           // tk_string       18
  80         null,           // tk_sequence     19
  81         null,           // tk_array        20
  82         null,           // tk_alias        21
  83         null,           // tk_except       22
  84         "J",            // tk_longlong     23
  85         "J",            // tk_ulonglong    24
  86         "D",            // tk_longdouble   25
  87         "C",            // tk_wchar        26
  88         null,           // tk_wstring      27
  89         null,       // tk_fixed        28
  90         null,       // tk_value        29
  91         null,       // tk_value_box    30
  92         null,       // tk_native       31
  93         null,       // tk_abstract_interface 32
  94     };








  95 
  96     public static String getSignature(ValueMember member)
  97         throws ClassNotFoundException {
  98 
  99         // REVISIT.  Can the type be something that is
 100         // non-primitive yet not a value_box, value, or objref?
 101         // If so, should use ObjectStreamClass or throw
 102         // exception.
 103 
 104         if (member.type.kind().value() == TCKind._tk_value_box ||
 105             member.type.kind().value() == TCKind._tk_value ||
 106             member.type.kind().value() == TCKind._tk_objref) {
 107             Class c = RepositoryId.cache.getId(member.id).getClassFromType();
 108             return ObjectStreamClass.getSignature(c);
 109 
 110         } else {
 111 
 112             return primitiveConstants[member.type.kind().value()];
 113         }
 114 


   1 /*
   2  * Copyright (c) 1999, 2012, 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


  75         null,           // tk_objref       14
  76         null,           // tk_struct       15
  77         null,           // tk_union        16
  78         null,           // tk_enum         17
  79         null,           // tk_string       18
  80         null,           // tk_sequence     19
  81         null,           // tk_array        20
  82         null,           // tk_alias        21
  83         null,           // tk_except       22
  84         "J",            // tk_longlong     23
  85         "J",            // tk_ulonglong    24
  86         "D",            // tk_longdouble   25
  87         "C",            // tk_wchar        26
  88         null,           // tk_wstring      27
  89         null,       // tk_fixed        28
  90         null,       // tk_value        29
  91         null,       // tk_value_box    30
  92         null,       // tk_native       31
  93         null,       // tk_abstract_interface 32
  94     };
  95 
  96     static {
  97         sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() {
  98             public ValueHandlerImpl newValueHandlerImpl() {
  99                 return ValueHandlerImpl.getInstance();
 100             }
 101         });
 102     }
 103 
 104     public static String getSignature(ValueMember member)
 105         throws ClassNotFoundException {
 106 
 107         // REVISIT.  Can the type be something that is
 108         // non-primitive yet not a value_box, value, or objref?
 109         // If so, should use ObjectStreamClass or throw
 110         // exception.
 111 
 112         if (member.type.kind().value() == TCKind._tk_value_box ||
 113             member.type.kind().value() == TCKind._tk_value ||
 114             member.type.kind().value() == TCKind._tk_objref) {
 115             Class c = RepositoryId.cache.getId(member.id).getClassFromType();
 116             return ObjectStreamClass.getSignature(c);
 117 
 118         } else {
 119 
 120             return primitiveConstants[member.type.kind().value()];
 121         }
 122