Class: JavaClass::ParameterAnnotationsAttribute
- Defined in:
- lib/javaclass/attribute.rb
Overview
引数のアノテーション属性
Instance Attribute Summary collapse
-
#parameter_annotations ⇒ Object
Returns the value of attribute parameter_annotations.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#[](index) ⇒ Object
引数のindexに対応するアノテーションの配列を取得する。 *index::引数の位置を示すインデックス 戻り値::引数に設定されたアノテーションの配列.
-
#[]=(index, annotations) ⇒ Object
引数のindexに対応するアノテーションの配列を設定する。 *index::引数の位置を示すインデックス *annotations::引数に設定するアノテーションの配列.
-
#initialize(java_class, name_index, parameter_annotations = []) ⇒ ParameterAnnotationsAttribute
constructor
コンストラクタ.
- #to_bytes ⇒ Object
Methods inherited from Attribute
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, name_index, parameter_annotations = []) ⇒ ParameterAnnotationsAttribute
コンストラクタ
*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス *parameter_annotations::パラメータ番号に対応するアノテーションの配列の配列
(0番目のパラメータのアノテーションは0番目の配列に格納される。)
707 708 709 710 |
# File 'lib/javaclass/attribute.rb', line 707 def initialize( java_class, name_index, parameter_annotations=[]) super( java_class, name_index ) @parameter_annotations = parameter_annotations end |
Instance Attribute Details
#parameter_annotations ⇒ Object
Returns the value of attribute parameter_annotations.
743 744 745 |
# File 'lib/javaclass/attribute.rb', line 743 def parameter_annotations @parameter_annotations end |
Instance Method Details
#[](index) ⇒ Object
引数のindexに対応するアノテーションの配列を取得する。
*index::引数の位置を示すインデックス 戻り値::引数に設定されたアノテーションの配列
717 718 719 |
# File 'lib/javaclass/attribute.rb', line 717 def [](index) @parameter_annotations[index] != nil ? @parameter_annotations[index] : [] end |
#[]=(index, annotations) ⇒ Object
引数のindexに対応するアノテーションの配列を設定する。
*index::引数の位置を示すインデックス *annotations::引数に設定するアノテーションの配列
725 726 727 |
# File 'lib/javaclass/attribute.rb', line 725 def []=(index,annotations) @parameter_annotations[index] = annotations end |
#to_bytes ⇒ Object
728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# File 'lib/javaclass/attribute.rb', line 728 def to_bytes bytes = super body = to_byte( @parameter_annotations.length, 1) @parameter_annotations.each {|annotations| body += to_byte( annotations != nil ? annotations.length : 0, 2) if ( annotations != nil ) annotations.each {|a| body += a.to_bytes() } end } bytes += to_byte( body.length, 4) bytes += body end |