クラスCustomAttribute<T extends CustomAttribute<T>>
java.lang.Object
java.lang.classfile.CustomAttribute<T>
- 型パラメータ:
T
- カスタム属性タイプ
- すべての実装されたインタフェース:
Attribute<T>
,ClassElement
,ClassFileElement
,CodeElement
,FieldElement
,MethodElement
public abstract non-sealed class CustomAttribute<T extends CustomAttribute<T>> extends Object implements Attribute<T>, CodeElement, ClassElement, MethodElement, FieldElement
class
ファイル内のユーザー定義属性をモデル化します。 ユーザー定義属性のAPIモデルでは、このクラスを拡張する必要があります。 ユーザー定義属性には、attributeMapper()
によって返され、ユーザー定義属性を読み取ることができるようにClassFile.AttributeMapperOption
に登録されるAttributeMapper
も定義する必要があります。
現在、ユーザー定義属性は、CodeModel
のトラバーサルでは配信されません。
class
ファイルから読み取られたユーザー定義属性のアクセッサ・メソッドでは、属性モデルが遅延評価され、評価で属性の不正なclass
ファイル形式が検出されると、IllegalArgumentException
がスローされる場合があります。
- 導入されたバージョン:
- 24
- 関連項目:
-
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
-
コンストラクタの詳細
-
CustomAttribute
-
-
メソッドの詳細
-
attributeMapper
public final AttributeMapper<T> attributeMapper()インタフェースからコピーされた説明:Attribute
この属性に関連付けられたAttributeMapper
を返します。- 定義:
- インタフェース
Attribute<T extends CustomAttribute<T>>
内のattributeMapper
- 戻り値:
- この属性に関連付けられた
AttributeMapper
-
attributeName
public Utf8Entry attributeName()属性の名前を返します。 名前の「文字列値」は、attributeMapper().name()
の値と同等です。この属性が
class
ファイルから読み取られると、このメソッドはclass
ファイル内の属性名を示すUtf8Entry
を返します。- 定義:
- インタフェース
Attribute<T extends CustomAttribute<T>>
内のattributeName
- 実装要件:
- デフォルトの実装では、書込みのみに適した
Utf8Entry
(「バインドなし」かのしれない)が返されます。class
ファイルから読み取られた属性を表すサブクラスは、このメソッドをオーバーライドする必要があります。 - 戻り値:
- 属性の名前
- 関連項目:
-