Class: JavaClass::ConstAnnotationElementValue

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, const_value_index = nil) ⇒ ConstAnnotationElementValue

コンストラクタ

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



556
557
558
559
# File 'lib/javaclass/attribute.rb', line 556

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

Instance Attribute Details

#const_value_indexObject

定数値を示すconstant_poolのインデックス



571
572
573
# File 'lib/javaclass/attribute.rb', line 571

def const_value_index
  @const_value_index
end

Instance Method Details

#to_bytesObject



566
567
568
569
# File 'lib/javaclass/attribute.rb', line 566

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

#to_sObject



563
564
565
# File 'lib/javaclass/attribute.rb', line 563

def to_s
  @java_class.get_constant_as_string(@const_value_index)
end

#valueObject



560
561
562
# File 'lib/javaclass/attribute.rb', line 560

def value
  @java_class.get_constant_value(@const_value_index)
end