Class: JavaClass::ClassAnnotationElementValue

Inherits:
AnnotationElementValue show all
Defined in:
lib/javaclass/attribute.rb

Overview

クラス型のアノテーションデータ

Instance Attribute Summary collapse

Attributes inherited from AnnotationElementValue

#tag

Instance Method Summary collapse

Methods included from Converters

convert_code, convert_field_descriptor, convert_method_descriptor

Methods included from Base

#==, #===, #dump, #eql?, #hash, #to_byte

Constructor Details

#initialize(java_class, tag = nil, class_info_index = nil) ⇒ ClassAnnotationElementValue

コンストラクタ

*java_class::属性の所有者であるJavaクラス *tag::データの種別を示すconstant_poolのインデックス *class_info_index::クラスを示すconstant_poolのインデックス



621
622
623
624
# File 'lib/javaclass/attribute.rb', line 621

def initialize( java_class, tag=nil, class_info_index=nil  )
  super( java_class, tag )
  @class_info_index = class_info_index
end

Instance Attribute Details

#class_info_indexObject

Returns the value of attribute class_info_index.



636
637
638
# File 'lib/javaclass/attribute.rb', line 636

def class_info_index
  @class_info_index
end

Instance Method Details

#class_infoObject



625
626
627
# File 'lib/javaclass/attribute.rb', line 625

def class_info
  @java_class.get_constant_value(@class_info_index)
end

#to_bytesObject



631
632
633
634
# File 'lib/javaclass/attribute.rb', line 631

def to_bytes
  bytes = super
  bytes += to_byte( @class_info_index, 2)
end

#to_sObject



628
629
630
# File 'lib/javaclass/attribute.rb', line 628

def to_s
  convert_field_descriptor(class_info) << ".class"
end