public abstract class TypeCode extends Object implements IDLEntity
TypeCode
オブジェクトの使用法:
NamedValue
オブジェクトは、引数および戻り値を表すために使用される。それらのコンポーネントの1つはAny
オブジェクトであり、AnyオブジェクトはTypeCode
オブジェクトをそのコンポーネントの1つとして持つ。
TypeCode
オブジェクトの表現は不透明ですが、抽象的には、TypeCode
オブジェクトの構成要素は次のとおりです。
TCKind
クラスのインスタンスに設定されるkind
フィールド
1ong
を記述するTypeCode
オブジェクトは、TCKind.tk_long
の種類を持ち、追加フィールドを持たない。OMG IDL型sequence<boolean, 10>
を記述するTypeCode
は、値TCKind.tk_sequence
のkind
フィールド、およびシーケンス要素の型およびシーケンスの長さのための、値boolean
および10
のフィールドを持つ。
TypeCode
オブジェクトは、さまざまな方法で取得できます。
Any.insert_X
メソッドの呼び出しから取得する。Xは基本的なIDL型。このメソッドは、型XのTypeCode
オブジェクトを生成し、そのオブジェクトをAny
オブジェクトのtype
フィールドに割り当てる。
たとえば次のメソッドは、最大30文字のstring
のTypeCode
オブジェクトを生成します。
org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30);
次では、5つのstring
のarray
についてTypeCode
オブジェクトを生成します。
org.omg.CORBA.TypeCode tcArray = orb.create_array_tc( 5, TCKind.tk_string);
次では、Accountという名前のインタフェースのTypeCode
オブジェクトを生成します。
org.omg.CORBA.TypeCode tcInterface = orb.create_interface_tc( "thisId", "Account");
Holder
クラスの_type
メソッドからの戻り値として取得する。これらのHolder
クラスは、idltojava
コンパイラによって生成される。
TypeCode
クラスのほとんどのメソッドはアクセス用メソッドであり、TypeCode
オブジェクトに格納されている情報は特定の型に固有です。そのため、メソッドはメソッドが適用される種類の型コードでのみ呼び出される必要があります。アクセス用メソッドが不適切な種類の型コードの情報にアクセスしようとすると、例外TypeCodePackage.BadKind
がスローされます。たとえば、discriminator_type
メソッドがunion
以外で呼び出されると、BadKind
がスローされます。これは、union
のみが識別子を持つためです。次のリストは、どのメソッドがどの種類の型コードに適用されるかを示します。
次のメソッドは、TypeCode
のすべての種類で呼び出すことができます。
equal
kind
次のメソッドは、objref
、struct
、union
、enum
、alias
、exception
、value
、value_box
、native
、およびabstract_interface
で呼び出すことができます。
id
name
次のメソッドは、struct
、union
、enum
、およびexception
で呼び出すことができます。
member_count
member_name
次のメソッドは、struct
、union
、およびexception
で呼び出すことができます。
member_type(int index)
次のメソッドは、union
で呼び出すことができます。
member_label
discriminator_type
default_index
次のメソッドは、string
、sequence
、およびarray
で呼び出すことができます。
length
次のメソッドは、alias
、sequence
、array
、およびvalue_box
で呼び出すことができます。
content_type
ほかのCORBA擬似オブジェクトと違って、TypeCode
オブジェクトは一般的なIDLパラメータとして渡すことができます。
parameter
メソッドおよびparam_count
メソッド(非推奨)はマッピングされません。
Java IDLはCORBA仕様を拡張し、struct
TypeCode
で許可されているすべてのオペレーションがexception
TypeCode
でも許可されるようにします。
コンストラクタと説明 |
---|
TypeCode() |
修飾子と型 | メソッドと説明 |
---|---|
abstract TypeCode |
concrete_base_type()
この
TypeCode オブジェクトで記述される値型の具象基底型を記述するTypeCode オブジェクトを返します。 |
abstract TypeCode |
content_type()
この
TypeCode オブジェクトによって記述されるオブジェクトのメンバーのIDL型を表すTypeCode オブジェクトを返します。 |
abstract int |
default_index()
デフォルト・メンバーのインデックス、またはデフォルトのメンバーがない場合は -1を返します。
|
abstract TypeCode |
discriminator_type()
デフォルトのメンバーではないすべてのラベルを記述する
TypeCode オブジェクトを返します。 |
abstract boolean |
equal(TypeCode tc)
この
TypeCode オブジェクトと指定されたTypeCodeオブジェクトが等しいかどうかを比較します。 |
abstract boolean |
equivalent(TypeCode tc)
この
TypeCode オブジェクトと指定されたTypeCode オブジェクトが等しいかどうかを判定します。 |
abstract short |
fixed_digits()
この
TypeCode オブジェクトで記述されたfixed型の桁数を返します。 |
abstract short |
fixed_scale()
この
TypeCode オブジェクトで記述されたfixed型のスケールを返します。 |
abstract TypeCode |
get_compact_typecode()
すべてのオプション名およびメンバー名フィールドを削除しますが、別名型コードはすべてそのまま残します。
|
abstract String |
id()
この
TypeCode オブジェクトの型を大域的に識別するリポジトリIDを取得します。 |
abstract TCKind |
kind()
この
TypeCode オブジェクトの種類を取得します。 |
abstract int |
length()
この
TypeCode オブジェクトによって記述される型の要素数を返します。 |
abstract int |
member_count()
この
TypeCode オブジェクトで記述される型のメンバー数を取得します。 |
abstract Any |
member_label(int index)
指定されたインデックスによって識別される共用体メンバーのラベルを取得します。
|
abstract String |
member_name(int index)
指定されたインデックスで識別されるメンバーの単純名を取得します。
|
abstract TypeCode |
member_type(int index)
指定されたインデックスで識別されるメンバーの型を記述する
TypeCode オブジェクトを取得します。 |
abstract short |
member_visibility(int index)
指定されたインデックスのメンバーの可視性を示す定数を返します。
|
abstract String |
name()
囲みスコープ内で
TypeCode オブジェクトを識別する単純名を取得します。 |
abstract short |
type_modifier()
この
TypeCode オブジェクトが記述する値型の修飾子を示す定数を返します。 |
public abstract boolean equal(TypeCode tc)
TypeCode
オブジェクトと指定されたTypeCodeオブジェクトが等しいかどうかを比較します。これらのTypeCode
オブジェクトは、それらが交換可能であり、TypeCode
操作が適用されたときに同じ結果になる場合に等価です。tc
- 比較対象のTypeCode
オブジェクトtrue
、そうでない場合はfalse
public abstract boolean equivalent(TypeCode tc)
TypeCode
オブジェクトと指定されたTypeCode
オブジェクトが等しいかどうかを判定します。
tc
- この型コードと比較する型コードtrue
、そうでない場合はfalse
public abstract TypeCode get_compact_typecode()
TypeCode
オブジェクトCORBA
パッケージに実装されていない機能についてのコメントpublic abstract TCKind kind()
TypeCode
オブジェクトの種類を取得します。型コードの種類は、どのTypeCode
メソッドが正常に呼び出すことができるかを示します。
kind
メソッドは、どのTypeCode
オブジェクトでも呼び出すことができます。
TypeCode
オブジェクトのkind
フィールドの値を示すTCKind
のインスタンスpublic abstract String id() throws BadKind
TypeCode
オブジェクトの型を大域的に識別するリポジトリIDを取得します。
id
メソッドは、オブジェクト参照、構造体、共用体、列挙、エイリアス、例外、value型、boxed value型、ネイティブ、および抽象インタフェースの型コードで呼び出すことができます。オブジェクト参照、例外、value型、boxed value型、ネイティブ、抽象インタフェースTypeCode
オブジェクトは、常にリポジトリIDを持ちます。インタフェース・リポジトリまたはORB.create_operation_list
メソッドから取得される構造体、共用体、列挙、およびエイリアスTypeCode
オブジェクトも常にリポジトリIDを持ちます。リポジトリIDがない場合、メソッドは空の文字列を返します。
TypeCode
オブジェクトのリポジトリID。リポジトリIDがない場合は空の文字列BadKind
- メソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract String name() throws BadKind
TypeCode
オブジェクトを識別する単純名を取得します。名前はリポジトリにローカルなので、TypeCode
オブジェクトから返された名前は、特定のリポジトリ内部の型の名前とは一致しない場合があり、空の文字列の場合もあります。
name
メソッドは、オブジェクト参照、構造体、共用体、列挙、エイリアス、例外、value型、boxed value型、ネイティブ、および抽象インタフェースTypeCode
オブジェクトで呼び出すことができます。
TypeCode
オブジェクトを識別する名前、または空の文字列BadKind
- メソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract int member_count() throws BadKind
TypeCode
オブジェクトで記述される型のメンバー数を取得します。
member_count
メソッドは、構造体、共用体、列挙TypeCode
オブジェクトで呼び出すことができます。Java IDLはCORBA仕様を拡張し、このメソッドが例外も処理できるようにします。
TypeCode
オブジェクトによって記述される型を構成するメンバーの数BadKind
- メソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract String member_name(int index) throws BadKind, Bounds
TypeCode
オブジェクトから返される名前は、特定のリポジトリのメンバー名と一致しない場合があり、空の文字列である場合もあります。
member_name
メソッドは、構造体、共用体、列挙TypeCode
オブジェクトで呼び出すことができます。Java IDLはCORBA仕様を拡張し、このメソッドが例外も処理できるようにします。
public abstract TypeCode member_type(int index) throws BadKind, Bounds
TypeCode
オブジェクトを取得します。
member_type
メソッドは、構造体および共用体TypeCode
オブジェクトで呼び出すことができます。Java IDLはCORBA仕様を拡張し、このメソッドが例外も処理できるようにします。
public abstract Any member_label(int index) throws BadKind, Bounds
member_label
メソッドは、共用体TypeCode
オブジェクトだけで呼び出すことができます。
public abstract TypeCode discriminator_type() throws BadKind
TypeCode
オブジェクトを返します。discriminator_type
メソッドは、共用体TypeCode
オブジェクトだけで呼び出すことができます。TypeCode
オブジェクトBadKind
- メソッドが、共用体ではないTypeCode
オブジェクトで呼び出された場合public abstract int default_index() throws BadKind
default_index
メソッドは、共用体TypeCode
オブジェクトだけで呼び出すことができます。
BadKind
- メソッドが、共用体ではないTypeCode
オブジェクトで呼び出された場合public abstract int length() throws BadKind
TypeCode
オブジェクトによって記述される型の要素数を返します。文字列およびシーケンスの場合はバウンドが返され、0はアンバウンドの文字列またはシーケンスを示します。配列の場合、配列の要素数が返されます。
length
メソッドは、文字列、シーケンス、および配列TypeCode
オブジェクトで呼び出すことができます。
BadKind
- メソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract TypeCode content_type() throws BadKind
TypeCode
オブジェクトによって記述されるオブジェクトのメンバーのIDL型を表すTypeCode
オブジェクトを返します。シーケンスおよび配列の場合は、要素の型が返されます。エイリアスの場合は、元の型が返されます。多次元配列は、次元ごとに1つのTypeCode
オブジェクトを入れ子にすることにより表されます。boxed value型の場合はboxed型が返されます。
content_type
メソッドは、シーケンス、配列、エイリアス、およびboxed value型TypeCode
オブジェクトで呼び出すことができます。
TypeCode
オブジェクト。BadKind
- メソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract short fixed_digits() throws BadKind
TypeCode
オブジェクトで記述されたfixed型の桁数を返します。たとえば、数値3000.275dの型コードはfixed<7,3>
です。7は精度、3はスケールです。BadKind
- このメソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract short fixed_scale() throws BadKind
TypeCode
オブジェクトで記述されたfixed型のスケールを返します。正の数値は、小数点の右側にある桁数を示します。たとえば、数値3000dの型コードはfixed<4,0>
です。最初の数値は精度で、2番目の数値はスケールです。負の数値も可能です。その場合は、小数点の左側にゼロを付けます。この場合、fixed<1,-3>
は数値3000dの型コードになります。TypeCode
オブジェクトで記述されるfixed型のスケールBadKind
- このメソッドが、不適切な種類のTypeCode
オブジェクトで呼び出された場合public abstract short member_visibility(int index) throws BadKind, Bounds
TypeCode
オブジェクトだけで呼び出すことができます。index
- 値へのインデックスを示すint
PRIVATE_MEMBER.value
またはPUBLIC_MEMBER.value
BadKind
- このメソッドが、値型ではないTypeCode
オブジェクトで呼び出された場合Bounds
- 指定したインデックスが範囲外にある場合CORBA
パッケージに実装されていない機能についてのコメントpublic abstract short type_modifier() throws BadKind
TypeCode
オブジェクトが記述する値型の修飾子を示す定数を返します。返される定数は、VM_NONE.value
、VM_ABSTRACT.value
、VM_CUSTOM.value
、またはVM_TRUNCATABLE.value
のどれかである必要があります。TypeCode
オブジェクトで記述される値型を記述する定数BadKind
- このメソッドが、値型ではないTypeCode
オブジェクトで呼び出された場合CORBA
パッケージに実装されていない機能についてのコメントpublic abstract TypeCode concrete_base_type() throws BadKind
TypeCode
オブジェクトで記述される値型の具象基底型を記述するTypeCode
オブジェクトを返します。具象基底型がない場合は、nullを返します。TypeCode
オブジェクトで記述される値型の具象基底型を記述するTypeCode
オブジェクトBadKind
- このメソッドが、boxed値型ではないTypeCode
オブジェクトで呼び出された場合CORBA
パッケージに実装されていない機能についてのコメント バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。