Interstage Application Server アプリケーション作成ガイド (CORBAサービス編)
目次 索引 前ページ次ページ

第6章 アプリケーションの開発(Java言語)> 6.17 データ型に対するマッピング

6.17.12 パラメタ受渡しで使用するデータ型

 クライアント/サーバアプリケーションでパラメタ受渡に使用するデータ型を以下に示します。

CORBAデータ型
in
out
inout
return
long
int
org.omg.CORBA.
IntHolder
org.omg.CORBA.
IntHolder
int
unsigned long
int
org.omg.CORBA.
IntHolder
org.omg.CORBA.
IntHolder
int
short
short
org.omg.CORBA.
ShortHolder
org.omg.CORBA.
ShortHolder
short
unsigned short
short
org.omg.CORBA.
ShortHolder
org.omg.CORBA.
ShortHolder
short
long long
long
org.omg.CORBA.
LongHolder
org.omg.CORBA.
LongHolder
long
float
float
org.omg.CORBA.
FloatHolder
org.omg.CORBA.
FloatHolder
float
double
double
org.omg.CORBA.
DoubleHolder
org.omg.CORBA.
DoubleHolder
double
boolean
boolean
org.omg.CORBA.
BooleanHolder
org.omg.CORBA.
BooleanHolder
boolean
char
char
org.omg.CORBA.
CharHolder
org.omg.CORBA.
CharHolder
char
wchar
char
org.omg.CORBA.
CharHolder
org.omg.CORBA.
CharHolder
char
octet
byte
org.omg.CORBA.
ByteHolder
org.omg.CORBA.
ByteHolder
byte
enum
データ名
class
データ名
Holderclass
データ名
Holderclass
データ名
class
struct
データ名
class
データ名
Holderclass
データ名
Holderclass
データ名
class
union
データ名
class
データ名
Holderclass
データ名
Holderclass
データ名
class
string
java.lang.
String
org.omg.CORBA.
StringHolder
org.omg.CORBA.
StringHolder
java.lang.
String
wstring
java.lang.
String
org.omg.CORBA.
StringHolder
org.omg.CORBA.
StringHolder
java.lang.
String
any
org.omg.CORBA.
Any
org.omg.CORBA.
AnyHolder
org.omg.CORBA.
AnyHolder
org.omg.CORBA.
Any
sequence
要素の型[ ]
データ名
Holderclass
データ名
Holderclass
要素の型[ ]
配列
要素の型の配列
データ名
Holderclass
データ名
Holderclass
要素の型の配列
array型
データ型配列
データ名
Holder
データ名
Holder
データ型配列
Object
org.omg.CORBA.
Object
org.omg.CORBA.
ObjectHolder
org.omg.CORBA.
ObjectHolder
org.omg.CORBA.
CORBA.Object
TypeCode
org.omg.CORBA.
TypeCode
org.omg.CORBA.
TypeCodeHolder
org.omg.CORBA.
TypeCodeHolder
org.omg.CORBA.
TypeCode

(1)string型の扱いについて

 Javaでstring型を扱う場合、文字列としてnullを設定する際、オブジェクトの値としてのnullではなく、「null文字列」を設定する必要があります。以下に設定の例を示します。

java.lang.String str = null;  // 誤り
java.lang.String str2 = new java.lang.String("");  // 正しい

(2)整数の扱いについて

 Javaで整数型を扱う場合、符号なしを意味するunsigned型がないため、IDL定義でunsigned型とした変数を扱う場合でも、代入する値は以下の範囲となるよう注意が必要です。

int   : - 2147483648 〜 + 2147483647
short : - 32768 〜 + 32767
long  : - 9223372036854775808 〜 + 9223372036854775807

(3)char型の扱いについて

 Javaでのchar型は、Unicode(16bit)となります。

(4)日本語の扱いについて

 IDL定義でchar/stringを使用した場合は、1バイト系文字/文字列だけの受渡しが可能となります。日本語文字/文字列の受渡しを行う場合は、IDL定義でwchar/wstringを使用してください。

(5)nullオブジェクトの設定について

 クライアントアプリケーションのin、inoutパラメタ、およびサーバアプリケーションのout、inoutパラメタ、復帰値では、文字列型、シーケンス型、構造体、共用体、配列、Any型に対し"nullオブジェクト"を設定することができません。

(6)Holderクラスの扱いについて

 クライアントアプリケーションのinoutパラメタ、およびサーバアプリケーションのoutパラメタで、Holderクラスを使用してパラメタ受渡しを行う場合は、必ずパラメタ受渡しの前にHolderクラスのインスタンス内のvalue変数に値を設定してください。


目次 索引 前ページ次ページ

All Rights Reserved, Copyright(C) 富士通株式会社 2005