Class: JavaClass::ArrayAnnotationElementValue

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, array = []) ⇒ ArrayAnnotationElementValue

コンストラクタ

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



676
677
678
679
# File 'lib/javaclass/attribute.rb', line 676

def initialize( java_class, tag=nil, array=[]  )
  super( java_class, tag )
  @array = array
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



692
693
694
# File 'lib/javaclass/attribute.rb', line 692

def array
  @array
end

Instance Method Details

#to_bytesObject



683
684
685
686
687
688
689
690
# File 'lib/javaclass/attribute.rb', line 683

def to_bytes
  bytes = super
  bytes += to_byte( @array.length, 2 )
  @array.each {|a|
    bytes += a.to_bytes()
  }
  return bytes
end

#to_sObject



680
681
682
# File 'lib/javaclass/attribute.rb', line 680

def to_s
  "[" << @array.map{|a| a.to_s }.join(",") << "]"
end