Class: JavaClass::NameAndTypeConstant
- 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
-
#descriptor_index ⇒ Object
Returns the value of attribute descriptor_index.
-
#name_index ⇒ Object
Returns the value of attribute name_index.
Attributes inherited from Constant
Instance Method Summary collapse
-
#descriptor ⇒ Object
ディスクリプタを取得する.
-
#initialize(java_class, tag = nil, name_index = nil, descriptor_index = nil) ⇒ NameAndTypeConstant
constructor
コンストラクタ.
-
#name ⇒ Object
名前を取得する.
- #to_bytes ⇒ Object
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, tag = nil, name_index = nil, descriptor_index = nil) ⇒ NameAndTypeConstant
コンストラクタ
*java_class::constantの所有者であるJavaクラス*tag::constantの種類を示すタグ*name_index::名前を示すconstant_poolのインデックス*descriptor_index::ディスクリプタを示すconstant_poolのインデックス
175 176 177 178 179 |
# File 'lib/javaclass/constant.rb', line 175 def initialize( java_class, tag=nil, name_index=nil, descriptor_index=nil ) super(java_class, tag) @name_index = name_index @descriptor_index = descriptor_index end |
Instance Attribute Details
#descriptor_index ⇒ Object
Returns the value of attribute descriptor_index.
202 203 204 |
# File 'lib/javaclass/constant.rb', line 202 def descriptor_index @descriptor_index end |
#name_index ⇒ Object
Returns the value of attribute name_index.
201 202 203 |
# File 'lib/javaclass/constant.rb', line 201 def name_index @name_index end |
Instance Method Details
#descriptor ⇒ Object
ディスクリプタを取得する
戻り値::ディスクリプタ
193 194 195 |
# File 'lib/javaclass/constant.rb', line 193 def descriptor @java_class.get_constant_value(@descriptor_index) end |
#name ⇒ Object
名前を取得する
戻り値::名前
185 186 187 |
# File 'lib/javaclass/constant.rb', line 185 def name @java_class.get_constant_value(@name_index) end |
#to_bytes ⇒ Object
196 197 198 199 200 |
# File 'lib/javaclass/constant.rb', line 196 def to_bytes() bytes = super bytes += to_byte( @name_index, 2 ) bytes += to_byte( @descriptor_index, 2 ) end |