Class: JavaClass::StringConstant
- 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 collapse
-
#string_index ⇒ Object
Returns the value of attribute string_index.
Attributes inherited from Constant
Instance Method Summary collapse
-
#bytes ⇒ Object
値を取得する.
-
#initialize(java_class, tag = nil, string_index = nil) ⇒ StringConstant
constructor
コンストラクタ.
- #to_bytes ⇒ Object
- #to_s ⇒ Object
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, tag = nil, string_index = nil) ⇒ StringConstant
コンストラクタ
*java_class::constantの所有者であるJavaクラス *tag::constantの種類を示すタグ *string_index::値を示すconstant_poolのインデックス
216 217 218 219 |
# File 'lib/javaclass/constant.rb', line 216 def initialize( java_class, tag=nil, string_index=nil ) super(java_class, tag) @string_index = string_index end |
Instance Attribute Details
#string_index ⇒ Object
Returns the value of attribute string_index.
235 236 237 |
# File 'lib/javaclass/constant.rb', line 235 def string_index @string_index end |
Instance Method Details
#bytes ⇒ Object
値を取得する
戻り値::値
225 226 227 |
# File 'lib/javaclass/constant.rb', line 225 def bytes @java_class.get_constant_value(@string_index) end |
#to_bytes ⇒ Object
228 229 230 231 |
# File 'lib/javaclass/constant.rb', line 228 def to_bytes() tmp = super tmp += to_byte( @string_index, 2) end |
#to_s ⇒ Object
232 233 234 |
# File 'lib/javaclass/constant.rb', line 232 def to_s bytes != nil ? "\"#{bytes}\"" : "null" end |