Class: JavaClass::AnnotationDefaultAttribute

Inherits:
Attribute
  • Object
show all
Defined in:
lib/javaclass/attribute.rb

Overview

アノテーションの初期値属性

Instance Attribute Summary collapse

Attributes inherited from Attribute

#java_class, #name_index

Instance Method Summary collapse

Methods inherited from Attribute

#name

Methods included from Base

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

Constructor Details

#initialize(java_class, name_index, element_value = nil) ⇒ AnnotationDefaultAttribute

コンストラクタ

*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス *element_value::アノテーションの初期値



757
758
759
760
# File 'lib/javaclass/attribute.rb', line 757

def initialize( java_class, name_index, element_value=nil )
  super( java_class, name_index)
  @element_value = element_value
end

Instance Attribute Details

#element_valueObject

Returns the value of attribute element_value.



771
772
773
# File 'lib/javaclass/attribute.rb', line 771

def element_value
  @element_value
end

Instance Method Details

#to_bytesObject



764
765
766
767
768
769
# File 'lib/javaclass/attribute.rb', line 764

def to_bytes
  bytes = super
  body = element_value.to_bytes()
  bytes += to_byte( body.length, 4)
  bytes += body
end

#to_sObject



761
762
763
# File 'lib/javaclass/attribute.rb', line 761

def to_s
  "default " << @element_value.to_s
end