インタフェースTypeAnnotation.TargetInfo
- 既知のすべてのサブインタフェース:
TypeAnnotation.CatchTargetPREVIEW
,TypeAnnotation.EmptyTargetPREVIEW
,TypeAnnotation.FormalParameterTargetPREVIEW
,TypeAnnotation.LocalVarTargetPREVIEW
,TypeAnnotation.OffsetTargetPREVIEW
,TypeAnnotation.SupertypeTargetPREVIEW
,TypeAnnotation.ThrowsTargetPREVIEW
,TypeAnnotation.TypeArgumentTargetPREVIEW
,TypeAnnotation.TypeParameterBoundTargetPREVIEW
,TypeAnnotation.TypeParameterTargetPREVIEW
- 含まれているインタフェース:
TypeAnnotationPREVIEW
public static sealed interface TypeAnnotation.TargetInfo permits TypeAnnotation.TypeParameterTargetPREVIEW, TypeAnnotation.SupertypeTargetPREVIEW, TypeAnnotation.TypeParameterBoundTargetPREVIEW, TypeAnnotation.EmptyTargetPREVIEW, TypeAnnotation.FormalParameterTargetPREVIEW, TypeAnnotation.ThrowsTargetPREVIEW, TypeAnnotation.LocalVarTargetPREVIEW, TypeAnnotation.CatchTargetPREVIEW, TypeAnnotation.OffsetTargetPREVIEW, TypeAnnotation.TypeArgumentTargetPREVIEW
TargetInfo
は、JavaプラットフォームのプレビューAPIです。
プレビュー機能は、今後のリリースで削除するか、Javaプラットフォームの永続機能にアップグレードすることができます。
宣言または式のどの型に注釈を付けるかを指定します。
-
メソッドのサマリー
修飾子と型メソッド説明of
(TypeAnnotation.TargetTypePREVIEW targetType) 注釈のターゲットを返します。ofCastExpr
(LabelPREVIEW target, int typeArgumentIndex) キャスト式のi番目の型の注釈のターゲットを返します。ofClassExtends
(int supertypeIndex) "extends"句または"implements"句の型に関する注釈のターゲットを返します。ofClassTypeParameter
(int typeParameterIndex) クラス型パラメータ宣言の注釈のターゲットを返します。ofClassTypeParameterBound
(int typeParameterIndex, int boundIndex) ジェネリック・クラスまたはインタフェースのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。ofConstructorInvocationTypeArgument
(LabelPREVIEW target, int typeArgumentIndex) 明示的なコンストラクタ呼出し文の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。ofConstructorReference
(LabelPREVIEW target) 前の型の注釈のターゲットを返します。 : コンストラクタ参照式ofConstructorReferenceTypeArgument
(LabelPREVIEW target, int typeArgumentIndex) 新しい式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。ofExceptionParameter
(int exceptionTableIndex) 例外パラメータ宣言のi番目の型の注釈のターゲットを返します。ofField()
フィールドまたはレコード宣言内の型の注釈のターゲットを返します。ofInstanceofExpr
(LabelPREVIEW target) instanceof式内の型に対する注釈のターゲットを返します。ローカル変数宣言内の型に対する注釈のターゲットを返します。ofMethodFormalParameter
(int formalParameterIndex) メソッド、コンストラクタまたはラムダ式の仮パラメータ宣言内の型に対する注釈のターゲットを返します。ofMethodInvocationTypeArgument
(LabelPREVIEW target, int typeArgumentIndex) メソッド呼出し式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。メソッドまたはコンストラクタのレシーバ・タイプに対する注釈のターゲットを返します。ofMethodReference
(LabelPREVIEW target) メソッド参照式内の::前の型の注釈のターゲットを返します。ofMethodReferenceTypeArgument
(LabelPREVIEW target, int typeArgumentIndex) メソッド参照式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。メソッドの戻り型または新しく構築されたオブジェクトの注釈のターゲットを返します。ofMethodTypeParameter
(int typeParameterIndex) メソッド型パラメータ宣言の注釈のターゲットを返します。ofMethodTypeParameterBound
(int typeParameterIndex, int boundIndex) ジェネリック・メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。新しい式内の型に対する注釈のターゲットを返します。ofOffset
(TypeAnnotation.TargetTypePREVIEW targetType, LabelPREVIEW target) instanceof式または新しい式内の型、またはメソッド参照式内の::前の型の注釈のターゲットを返します。try-with-resources文でリソースとして宣言されたローカル変数内の型に対する注釈のターゲットを返します。ofThrows
(int throwsTargetIndex) メソッドまたはコンストラクタ宣言のthrows句のi番目の型に対する注釈のターゲットを返します。ofTypeArgument
(TypeAnnotation.TargetTypePREVIEW targetType, LabelPREVIEW target, int typeArgumentIndex) キャスト式内のi番目の型、または明示的な型引数リスト内のi番目の型引数で、次のいずれかの注釈のターゲットを返します: 新しい式、明示的なコンストラクタ呼出し文、メソッド呼出し式またはメソッド参照式。ofTypeParameter
(TypeAnnotation.TargetTypePREVIEW targetType, int typeParameterIndex) クラスまたはメソッド型のパラメータ宣言の注釈のターゲットを返します。ofTypeParameterBound
(TypeAnnotation.TargetTypePREVIEW targetType, int typeParameterIndex, int boundIndex) 汎用クラス、インタフェース、メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。ofVariable
(TypeAnnotation.TargetTypePREVIEW targetType, List<TypeAnnotation.LocalVarTargetInfoPREVIEW> table) try-with-resources文でリソースとして宣言された変数を含む、ローカル変数宣言内の型に対する注釈のターゲットを返します。default int
size()
ターゲット情報のサイズを返します。ターゲットのタイプを返します。
-
メソッドの詳細
-
targetType
-
size
default int size()ターゲット情報のサイズを返します。- 戻り値:
- ターゲット情報のサイズ
-
ofTypeParameter
static TypeAnnotation.TypeParameterTargetPREVIEW ofTypeParameter(TypeAnnotation.TargetTypePREVIEW targetType, int typeParameterIndex) クラスまたはメソッド型のパラメータ宣言の注釈のターゲットを返します。- パラメータ:
targetType
-TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER
PREVIEWまたはTypeAnnotation.TargetType.METHOD_TYPE_PARAMETER
PREVIEWtypeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。- 戻り値:
- クラスまたはメソッド型のパラメータ宣言の注釈のターゲット
-
ofClassTypeParameter
static TypeAnnotation.TypeParameterTargetPREVIEW ofClassTypeParameter(int typeParameterIndex) クラス型パラメータ宣言の注釈のターゲットを返します。- パラメータ:
typeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。- 戻り値:
- クラス型パラメータ宣言の注釈のターゲット
-
ofMethodTypeParameter
static TypeAnnotation.TypeParameterTargetPREVIEW ofMethodTypeParameter(int typeParameterIndex) メソッド型パラメータ宣言の注釈のターゲットを返します。- パラメータ:
typeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。- 戻り値:
- メソッド型パラメータ宣言の注釈のターゲット
-
ofClassExtends
static TypeAnnotation.SupertypeTargetPREVIEW ofClassExtends(int supertypeIndex) "extends"句または"implements"句の型に関する注釈のターゲットを返します。- パラメータ:
supertypeIndex
- インタフェース配列への索引、またはスーパークラスであることを示す65535- 戻り値:
- "extends"句または"implements"句の型に対する注釈のターゲット
-
ofTypeParameterBound
static TypeAnnotation.TypeParameterBoundTargetPREVIEW ofTypeParameterBound(TypeAnnotation.TargetTypePREVIEW targetType, int typeParameterIndex, int boundIndex) 汎用クラス、インタフェース、メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。- パラメータ:
targetType
-TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER_BOUND
PREVIEWまたはTypeAnnotation.TargetType.METHOD_TYPE_PARAMETER_BOUND
PREVIEWtypeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。boundIndex
- 型パラメータ宣言のどの境界に注釈を付けるかを指定します- 戻り値:
- 汎用クラス、インタフェース、メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲット
-
ofClassTypeParameterBound
static TypeAnnotation.TypeParameterBoundTargetPREVIEW ofClassTypeParameterBound(int typeParameterIndex, int boundIndex) ジェネリック・クラスまたはインタフェースのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。- パラメータ:
typeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。boundIndex
- 型パラメータ宣言のどの境界に注釈を付けるかを指定します- 戻り値:
- 汎用クラスまたはインタフェースのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲット
-
ofMethodTypeParameterBound
static TypeAnnotation.TypeParameterBoundTargetPREVIEW ofMethodTypeParameterBound(int typeParameterIndex, int boundIndex) ジェネリック・メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲットを返します。- パラメータ:
typeParameterIndex
- 注釈を付ける型パラメータ宣言を指定します。boundIndex
- 型パラメータ宣言のどの境界に注釈を付けるかを指定します- 戻り値:
- ジェネリック・メソッドまたはコンストラクタのj番目の型パラメータ宣言のi番目の境界にある注釈のターゲット
-
of
static TypeAnnotation.EmptyTargetPREVIEW of(TypeAnnotation.TargetTypePREVIEW targetType) 注釈のターゲットを返します。- パラメータ:
targetType
-TypeAnnotation.TargetType.FIELD
PREVIEW、TypeAnnotation.TargetType.METHOD_RETURN
PREVIEWまたはTypeAnnotation.TargetType.METHOD_RECEIVER
PREVIEW- 戻り値:
- 注釈のターゲット
-
ofField
static TypeAnnotation.EmptyTargetPREVIEW ofField()フィールドまたはレコード宣言内の型の注釈のターゲットを返します。- 戻り値:
- フィールドまたはレコード宣言内の型に対する注釈のターゲット
-
ofMethodReturn
static TypeAnnotation.EmptyTargetPREVIEW ofMethodReturn()メソッドの戻り型または新しく構築されたオブジェクトの注釈のターゲットを返します。- 戻り値:
- メソッドの戻り型または新しく構築されたオブジェクトの注釈のターゲット
-
ofMethodReceiver
static TypeAnnotation.EmptyTargetPREVIEW ofMethodReceiver()メソッドまたはコンストラクタのレシーバ・タイプに対する注釈のターゲットを返します。- 戻り値:
- メソッドまたはコンストラクタの受信側タイプでの注釈のターゲット
-
ofMethodFormalParameter
static TypeAnnotation.FormalParameterTargetPREVIEW ofMethodFormalParameter(int formalParameterIndex) メソッド、コンストラクタまたはラムダ式の仮パラメータ宣言内の型に対する注釈のターゲットを返します。- パラメータ:
formalParameterIndex
- 注釈付き型を持つ仮パラメータ宣言を指定します。- 戻り値:
- メソッド、コンストラクタまたはラムダ式の仮パラメータ宣言内の型に対する注釈のターゲット
-
ofThrows
static TypeAnnotation.ThrowsTargetPREVIEW ofThrows(int throwsTargetIndex) メソッドまたはコンストラクタ宣言のthrows句のi番目の型に対する注釈のターゲットを返します。- パラメータ:
throwsTargetIndex
- メソッドの例外属性の例外表への索引- 戻り値:
- メソッドまたはコンストラクタ宣言のthrows句のi番目の型に対する注釈のターゲット
-
ofVariable
static TypeAnnotation.LocalVarTargetPREVIEW ofVariable(TypeAnnotation.TargetTypePREVIEW targetType, List<TypeAnnotation.LocalVarTargetInfoPREVIEW> table) try-with-resources文でリソースとして宣言された変数を含む、ローカル変数宣言内の型に対する注釈のターゲットを返します。- パラメータ:
targetType
-TypeAnnotation.TargetType.LOCAL_VARIABLE
PREVIEWまたはTypeAnnotation.TargetType.RESOURCE_VARIABLE
PREVIEWtable
- ローカル変数ターゲットのリスト- 戻り値:
- try-with-resources文でリソースとして宣言された変数を含む、ローカル変数宣言内の型に対する注釈のターゲット
-
ofLocalVariable
static TypeAnnotation.LocalVarTargetPREVIEW ofLocalVariable(List<TypeAnnotation.LocalVarTargetInfoPREVIEW> table) ローカル変数宣言内の型に対する注釈のターゲットを返します。- パラメータ:
table
- ローカル変数ターゲットのリスト- 戻り値:
- ローカル変数宣言内の型に対する注釈のターゲット
-
ofResourceVariable
static TypeAnnotation.LocalVarTargetPREVIEW ofResourceVariable(List<TypeAnnotation.LocalVarTargetInfoPREVIEW> table) try-with-resources文でリソースとして宣言されたローカル変数内の型に対する注釈のターゲットを返します。- パラメータ:
table
- ローカル変数ターゲットのリスト- 戻り値:
- try-with-resources文でリソースとして宣言されたローカル変数内の型に対する注釈のターゲット
-
ofExceptionParameter
static TypeAnnotation.CatchTargetPREVIEW ofExceptionParameter(int exceptionTableIndex) 例外パラメータ宣言のi番目の型の注釈のターゲットを返します。- パラメータ:
exceptionTableIndex
- Code属性の例外表への索引- 戻り値:
- 例外パラメータ宣言のi番目の型に対する注釈のターゲット
-
ofOffset
static TypeAnnotation.OffsetTargetPREVIEW ofOffset(TypeAnnotation.TargetTypePREVIEW targetType, LabelPREVIEW target) instanceof式または新しい式内の型、またはメソッド参照式内の::前の型の注釈のターゲットを返します。- パラメータ:
targetType
-TypeAnnotation.TargetType.INSTANCEOF
PREVIEW、TypeAnnotation.TargetType.NEW
PREVIEW、TypeAnnotation.TargetType.CONSTRUCTOR_REFERENCE
PREVIEWまたはTypeAnnotation.TargetType.METHOD_REFERENCE
PREVIEWtarget
- 命令に対応するコード・ラベル- 戻り値:
- instanceof式または新しい式内の型、または前の型の注釈のターゲット :: メソッド参照式内
-
ofInstanceofExpr
static TypeAnnotation.OffsetTargetPREVIEW ofInstanceofExpr(LabelPREVIEW target) instanceof式内の型に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベル- 戻り値:
- instanceof式内の型に対する注釈のターゲット
-
ofNewExpr
static TypeAnnotation.OffsetTargetPREVIEW ofNewExpr(LabelPREVIEW target) 新しい式内の型に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベル- 戻り値:
- 新しい式の型に対する注釈のターゲット
-
ofConstructorReference
static TypeAnnotation.OffsetTargetPREVIEW ofConstructorReference(LabelPREVIEW target) 前の型の注釈のターゲットを返します。 : コンストラクタ参照式- パラメータ:
target
- 命令に対応するコード・ラベル- 戻り値:
- 前の型の注釈のターゲット :: コンストラクタ参照式内
-
ofMethodReference
static TypeAnnotation.OffsetTargetPREVIEW ofMethodReference(LabelPREVIEW target) メソッド参照式内の::前の型の注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベル- 戻り値:
- 前の型の注釈のターゲット :: メソッド参照式内
-
ofTypeArgument
static TypeAnnotation.TypeArgumentTargetPREVIEW ofTypeArgument(TypeAnnotation.TargetTypePREVIEW targetType, LabelPREVIEW target, int typeArgumentIndex) キャスト式内のi番目の型、または明示的な型引数リスト内のi番目の型引数で、次のいずれかの注釈のターゲットを返します: 新しい式、明示的なコンストラクタ呼出し文、メソッド呼出し式またはメソッド参照式。- パラメータ:
targetType
-TypeAnnotation.TargetType.CAST
PREVIEW、TypeAnnotation.TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
PREVIEW、TypeAnnotation.TargetType.METHOD_INVOCATION_TYPE_ARGUMENT
PREVIEW、TypeAnnotation.TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
PREVIEWまたはTypeAnnotation.TargetType.METHOD_REFERENCE_TYPE_ARGUMENT
PREVIEWtarget
- 命令に対応するコード・ラベルtypeArgumentIndex
- キャスト演算子または引数のどの型に注釈を付けるかを指定します- 戻り値:
- キャスト式内のi番目の型に対する注釈のターゲット、または次のいずれかの明示的な型引数リストのi番目の型引数: 新しい式、明示的なコンストラクタ呼出し文、メソッド呼出し式またはメソッド参照式
-
ofCastExpr
static TypeAnnotation.TypeArgumentTargetPREVIEW ofCastExpr(LabelPREVIEW target, int typeArgumentIndex) キャスト式のi番目の型の注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベルtypeArgumentIndex
- キャスト演算子で注釈を付ける型を指定します。- 戻り値:
- キャスト式のi番目の型に対する注釈のターゲット
-
ofConstructorInvocationTypeArgument
static TypeAnnotation.TypeArgumentTargetPREVIEW ofConstructorInvocationTypeArgument(LabelPREVIEW target, int typeArgumentIndex) 明示的なコンストラクタ呼出し文の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベルtypeArgumentIndex
- 引数のどの型に注釈を付けるかを指定します。- 戻り値:
- 明示的なコンストラクタ呼出し文の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲット
-
ofMethodInvocationTypeArgument
static TypeAnnotation.TypeArgumentTargetPREVIEW ofMethodInvocationTypeArgument(LabelPREVIEW target, int typeArgumentIndex) メソッド呼出し式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベルtypeArgumentIndex
- 引数のどの型に注釈を付けるかを指定します。- 戻り値:
- メソッド呼出し式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲット
-
ofConstructorReferenceTypeArgument
static TypeAnnotation.TypeArgumentTargetPREVIEW ofConstructorReferenceTypeArgument(LabelPREVIEW target, int typeArgumentIndex) 新しい式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベルtypeArgumentIndex
- 引数のどの型に注釈を付けるかを指定します。- 戻り値:
- 新しい式の明示的な型引数リストのi番目の型引数に対する注釈のターゲット
-
ofMethodReferenceTypeArgument
static TypeAnnotation.TypeArgumentTargetPREVIEW ofMethodReferenceTypeArgument(LabelPREVIEW target, int typeArgumentIndex) メソッド参照式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲットを返します。- パラメータ:
target
- 命令に対応するコード・ラベルtypeArgumentIndex
- 引数のどの型に注釈を付けるかを指定します。- 戻り値:
- メソッド参照式の明示的な型引数リストにあるi番目の型引数に対する注釈のターゲット
-
TargetInfo
を使用できます。