Class: JavaClass::ConstantValueAttribute
- Defined in:
- lib/javaclass/attribute.rb
Overview
定数値属性
Instance Attribute Summary collapse
-
#constant_value_index ⇒ Object
定数値を示すconstant_poolのインデックス.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#initialize(java_class, name_index, constant_value_index) ⇒ ConstantValueAttribute
constructor
コンストラクタ.
- #to_bytes ⇒ Object
-
#to_s ⇒ Object
定数値の文字列表現を取得する。.
-
#value ⇒ Object
定数値を取得する。.
Methods inherited from Attribute
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, name_index, constant_value_index) ⇒ ConstantValueAttribute
コンストラクタ
*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス *constant_value_index::定数値を示すconstant_poolのインデックス
49 50 51 52 |
# File 'lib/javaclass/attribute.rb', line 49 def initialize( java_class, name_index, constant_value_index ) super( java_class, name_index) @constant_value_index = constant_value_index end |
Instance Attribute Details
#constant_value_index ⇒ Object
定数値を示すconstant_poolのインデックス
77 78 79 |
# File 'lib/javaclass/attribute.rb', line 77 def constant_value_index @constant_value_index end |
Instance Method Details
#to_bytes ⇒ Object
70 71 72 73 74 |
# File 'lib/javaclass/attribute.rb', line 70 def to_bytes bytes = super bytes += to_byte( 2, 4) bytes += to_byte( @constant_value_index, 2) end |
#to_s ⇒ Object
定数値の文字列表現を取得する。
戻り値::定数値の文字列表現
66 67 68 |
# File 'lib/javaclass/attribute.rb', line 66 def to_s @java_class.get_constant_as_string(@constant_value_index) end |
#value ⇒ Object
定数値を取得する。
戻り値::定数値
58 59 60 |
# File 'lib/javaclass/attribute.rb', line 58 def value @java_class.get_constant_value(@constant_value_index) end |