Class: JavaClass::InnerClass
- Inherits:
-
Object
- Object
- JavaClass::InnerClass
- Includes:
- Base
- Defined in:
- lib/javaclass/attribute.rb
Overview
インナークラス
Instance Attribute Summary collapse
-
#access_flag ⇒ Object
アクセスフラグ.
-
#inner_class_index ⇒ Object
インナークラス情報を示すconstant_poolのインデックス.
-
#name_index ⇒ Object
インナークラス名を示すconstant_poolのインデックス.
-
#outer_class_index ⇒ Object
インナークラスを所有するクラスの情報を示すconstant_poolのインデックス.
Instance Method Summary collapse
-
#initialize(java_class, inner_class_index = nil, outer_class_index = nil, name_index = nil, access_flag = nil) ⇒ InnerClass
constructor
コンストラクタ.
-
#inner_class ⇒ Object
インナークラスの情報を取得する。.
-
#name ⇒ Object
インナークラスの名前を取得する。無名クラスの場合nilが返される.
-
#outer_class ⇒ Object
インナークラスを所有するクラスの情報を取得する。.
- #to_bytes ⇒ Object
- #to_s ⇒ Object
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, inner_class_index = nil, outer_class_index = nil, name_index = nil, access_flag = nil) ⇒ InnerClass
コンストラクタ
*java_class::属性の所有者であるJavaクラス *inner_class_index::インナークラス情報を示すconstant_poolのインデックス *outer_class_index::インナークラスを所有するクラスの情報を示すconstant_poolのインデックス *name_index::インナークラス名を示すconstant_poolのインデックス *access_flag::アクセスフラグ
168 169 170 171 172 173 174 175 |
# File 'lib/javaclass/attribute.rb', line 168 def initialize( java_class, inner_class_index=nil, \ outer_class_index=nil, name_index=nil, access_flag=nil ) @java_class = java_class @inner_class_index = inner_class_index @outer_class_index = outer_class_index @name_index = name_index @access_flag = access_flag end |
Instance Attribute Details
#access_flag ⇒ Object
アクセスフラグ
220 221 222 |
# File 'lib/javaclass/attribute.rb', line 220 def access_flag @access_flag end |
#inner_class_index ⇒ Object
インナークラス情報を示すconstant_poolのインデックス
214 215 216 |
# File 'lib/javaclass/attribute.rb', line 214 def inner_class_index @inner_class_index end |
#name_index ⇒ Object
インナークラス名を示すconstant_poolのインデックス
218 219 220 |
# File 'lib/javaclass/attribute.rb', line 218 def name_index @name_index end |
#outer_class_index ⇒ Object
インナークラスを所有するクラスの情報を示すconstant_poolのインデックス
216 217 218 |
# File 'lib/javaclass/attribute.rb', line 216 def outer_class_index @outer_class_index end |
Instance Method Details
#inner_class ⇒ Object
インナークラスの情報を取得する。
戻り値::インナークラスの情報。
182 183 184 |
# File 'lib/javaclass/attribute.rb', line 182 def inner_class @java_class.get_constant( @inner_class_index ) end |
#name ⇒ Object
インナークラスの名前を取得する。無名クラスの場合nilが返される
戻り値::インナークラスの名前。無名クラスの場合nilが返される
199 200 201 |
# File 'lib/javaclass/attribute.rb', line 199 def name @name_index == 0 ? nil : @java_class.get_constant_value(@name_index) end |
#outer_class ⇒ Object
インナークラスを所有するクラスの情報を取得する。
戻り値::インナークラスを所有するクラスの情報。匿名クラスの場合はnullが返される。
191 192 193 |
# File 'lib/javaclass/attribute.rb', line 191 def outer_class @java_class.get_constant( @outer_class_index ) end |
#to_bytes ⇒ Object
207 208 209 210 211 212 |
# File 'lib/javaclass/attribute.rb', line 207 def to_bytes bytes = to_byte( @inner_class_index, 2) bytes += to_byte( @outer_class_index, 2) bytes += to_byte( @name_index, 2) bytes += @access_flag.to_bytes() end |
#to_s ⇒ Object
202 203 204 205 206 |
# File 'lib/javaclass/attribute.rb', line 202 def to_s str = "// use inner #{@access_flag.to_s}" str << " " << inner_class.name if inner_class != nil return str end |