001 /* DynAnyFactoryOperations.java -- 002 Copyright (C) 2005, 2006 Free Software Foundation, Inc. 003 004 This file is part of GNU Classpath. 005 006 GNU Classpath is free software; you can redistribute it and/or modify 007 it under the terms of the GNU General Public License as published by 008 the Free Software Foundation; either version 2, or (at your option) 009 any later version. 010 011 GNU Classpath is distributed in the hope that it will be useful, but 012 WITHOUT ANY WARRANTY; without even the implied warranty of 013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 General Public License for more details. 015 016 You should have received a copy of the GNU General Public License 017 along with GNU Classpath; see the file COPYING. If not, write to the 018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 019 02110-1301 USA. 020 021 Linking this library statically or dynamically with other modules is 022 making a combined work based on this library. Thus, the terms and 023 conditions of the GNU General Public License cover the whole 024 combination. 025 026 As a special exception, the copyright holders of this library give you 027 permission to link this library with independent modules to produce an 028 executable, regardless of the license terms of these independent 029 modules, and to copy and distribute the resulting executable under 030 terms of your choice, provided that you also meet, for each linked 031 independent module, the terms and conditions of the license of that 032 module. An independent module is a module which is not derived from 033 or based on this library. If you modify this library, you may extend 034 this exception to your version of the library, but you are not 035 obligated to do so. If you do not wish to do so, delete this 036 exception statement from your version. */ 037 038 039 package org.omg.DynamicAny; 040 041 import org.omg.CORBA.Any; 042 import org.omg.CORBA.TCKind; 043 import org.omg.CORBA.TypeCode; 044 import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; 045 046 /** 047 * Defines the operations, applicable for DynAnyFactory. These operations 048 * produce new DynAny's either from Any, serving as a template and value 049 * provider, or from the given typecode. 050 * 051 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 052 */ 053 public interface DynAnyFactoryOperations 054 { 055 /** 056 * Create DynAny for holding the data of the given type. The returned DynAny 057 * is initialised to its agreed default value. The agreed default values are: 058 * <table border='1'> 059 * <tr> 060 * <th>Type</th> 061 * <th>Value</th> 062 * <th>Creates</th> 063 * </tr> 064 * 065 * <tr> 066 * <td>boolean</td> 067 * <td>false</td> 068 * <td>{@link DynAny}</td> 069 * </tr> 070 * <tr> 071 * <td>numeric types, octet, fixed</td> 072 * <td>0</td> 073 * <td>{@link DynAny}</td> 074 * </tr> 075 * <tr> 076 * <td>char, wchar</td> 077 * <td>(char) 0</td> 078 * <td>{@link DynAny}</td> 079 * </tr> 080 * <tr> 081 * <td>string, wstring</td> 082 * <td>empty string ("", not <code>null<code>)</td> 083 * <td>{@link DynAny}</td> 084 * </tr> 085 * <tr> 086 * <td>{@link Any}</td> 087 * <td>{@link Any} with no value and typecode of kind {@link TCKind#tk_null}</td> 088 * <td>{@link DynAny}</td> 089 * </tr> 090 * <tr> 091 * <td>Sequence</td> 092 * <td>Empty (zero size) sequence</td> 093 * <td>{@link DynSequence}</td> 094 * </tr> 095 * <tr> 096 * <td>Array</td> 097 * <td>All members of array are recursively initialised to default values.</td> 098 * <td>{@link DynArray}</td> 099 * </tr> 100 * <tr> 101 * <td>Structure, exception</td> 102 * <td>All fields of the structure (if any) are recursively initialised to 103 * default values.</td> 104 * <td>{@link DynStruct}</td> 105 * </tr> 106 * <tr> 107 * <td>Enumeration</td> 108 * <td>Default value, indicated by typecode.</td> 109 * <td>{@link DynEnum}</td> 110 * </tr> 111 * <tr> 112 * <td>Union</td> 113 * <td>Default variant (indicated by typecode), recursively initialised to 114 * its default value.</td> 115 * <td>{@link DynUnion}</td> 116 * </tr> 117 * <tr> 118 * <td>Value, ValueBox</td> 119 * <td>null</td> 120 * <td>{@link DynValue}, {@link DynValueBox}</td> 121 * </tr> 122 * <tr> 123 * <td>TypeCode</td> 124 * <td>Typecode of kind <code>TCKind.tk_null</code></td> 125 * <td>{@link DynValue}, {@link DynValueBox}</td> 126 * </tr> 127 * 128 * </table> 129 * 130 * @param type the type of the data being stored. 131 * 132 * @return the created DynAny, having the passed type. 133 * 134 * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or 135 * tk_abstract_interface. These types cannot be stored in DynAny. 136 */ 137 DynAny create_dyn_any_from_type_code(TypeCode type) 138 throws InconsistentTypeCode; 139 140 /** 141 * Create DynAny using the given Any as template. 142 * 143 * @param value the Any, providing type and value for the DynAny being 144 * created. 145 * 146 * @return the created DynAny, having the same type and storing the same value 147 * as the passed Any. 148 * 149 * @throws InconsistentTypeCode if value.type().kind() is tk_Principal, 150 * tk_native or tk_abstract_interface. These types cannot be stored in DynAny. 151 */ 152 DynAny create_dyn_any(Any value) 153 throws InconsistentTypeCode; 154 }