Class: JavaClass::AnnotationsAttribute
- Defined in:
- lib/javaclass/attribute.rb
Overview
アノテーション属性
Instance Attribute Summary collapse
-
#annotations ⇒ Object
Returns the value of attribute annotations.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#initialize(java_class, name_index, annotations = []) ⇒ AnnotationsAttribute
constructor
コンストラクタ.
- #to_bytes ⇒ Object
- #to_s ⇒ Object
Methods inherited from Attribute
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, name_index, annotations = []) ⇒ AnnotationsAttribute
コンストラクタ
*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス *annotations::アノテーションの配列
427 428 429 430 |
# File 'lib/javaclass/attribute.rb', line 427 def initialize( java_class, name_index, annotations=[] ) super( java_class, name_index) @annotations = annotations end |
Instance Attribute Details
#annotations ⇒ Object
Returns the value of attribute annotations.
444 445 446 |
# File 'lib/javaclass/attribute.rb', line 444 def annotations @annotations end |
Instance Method Details
#to_bytes ⇒ Object
434 435 436 437 438 439 440 441 442 |
# File 'lib/javaclass/attribute.rb', line 434 def to_bytes bytes = super body = to_byte( @annotations.length, 2) @annotations.each {|c| body += c.to_bytes() } bytes += to_byte( body.length, 4) bytes += body end |
#to_s ⇒ Object
431 432 433 |
# File 'lib/javaclass/attribute.rb', line 431 def to_s @annotations.map{|a| a.to_s }.join("\n") end |