Class: JavaClass::IntegerConstant

Inherits:
Constant
  • Object
show all
Defined in:
lib/javaclass/constant.rb

Overview

整数のConstant

Constant Summary

Constants inherited from Constant

Constant::CONSTANT_Class, Constant::CONSTANT_Double, Constant::CONSTANT_Fieldref, Constant::CONSTANT_Float, Constant::CONSTANT_Integer, Constant::CONSTANT_InterfaceMethodref, Constant::CONSTANT_Long, Constant::CONSTANT_Methodref, Constant::CONSTANT_NameAndType, Constant::CONSTANT_String, Constant::CONSTANT_Utf8

Instance Attribute Summary

Attributes inherited from Constant

#java_class, #tag

Instance Method Summary collapse

Methods included from Base

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

Constructor Details

#initialize(java_class, tag = nil, bytes = nil) ⇒ IntegerConstant

コンストラクタ

*java_class::constantの所有者であるJavaクラス *tag::constantの種類を示すタグ *bytes::値



279
280
281
282
# File 'lib/javaclass/constant.rb', line 279

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

Instance Method Details

#bytesObject



283
284
285
# File 'lib/javaclass/constant.rb', line 283

def bytes()
  IntegerConstant::value_from_bytes(@bytes)
end

#bytes=(value) ⇒ Object



286
287
288
# File 'lib/javaclass/constant.rb', line 286

def bytes=(value)
  @bytes = IntegerConstant::bytes_from_value(value)
end

#to_bytesObject



289
290
291
292
# File 'lib/javaclass/constant.rb', line 289

def to_bytes()
  tmp = super
  tmp += to_byte( @bytes, 4 )
end

#to_sObject



293
294
295
# File 'lib/javaclass/constant.rb', line 293

def to_s
  bytes.to_s
end