Class: JavaClass::Member
- Inherits:
-
Object
- Object
- JavaClass::Member
- Includes:
- Base, Converters, Item
- Defined in:
- lib/javaclass/member.rb
Overview
Field,Methodの基底クラス
Instance Attribute Summary collapse
-
#access_flag ⇒ Object
アクセスフラグ.
-
#attributes ⇒ Object
属性名をキーとする属性のハッシュ.
-
#descriptor_index ⇒ Object
ディスクリプタを示すconstant_poolのインデックス.
-
#java_class ⇒ Object
JavaClass.
-
#name_index ⇒ Object
名前を示すconstant_poolのインデックス.
Instance Method Summary collapse
-
#descriptor ⇒ Object
ディスクリプタを取得する。.
-
#initialize(java_class) ⇒ Member
constructor
コンストラクタ.
-
#name ⇒ Object
名前を取得する。.
- #to_bytes ⇒ Object
Methods included from Item
#annotations, #deprecated?, #signature
Methods included from Converters
convert_code, convert_field_descriptor, convert_method_descriptor
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class) ⇒ Member
コンストラクタ
*java_class::メンバーの所有者であるJavaクラス
18 19 20 21 |
# File 'lib/javaclass/member.rb', line 18 def initialize( java_class ) @java_class = java_class @attributes = {} end |
Instance Attribute Details
#access_flag ⇒ Object
アクセスフラグ
51 52 53 |
# File 'lib/javaclass/member.rb', line 51 def access_flag @access_flag end |
#attributes ⇒ Object
属性名をキーとする属性のハッシュ
57 58 59 |
# File 'lib/javaclass/member.rb', line 57 def attributes @attributes end |
#descriptor_index ⇒ Object
ディスクリプタを示すconstant_poolのインデックス
55 56 57 |
# File 'lib/javaclass/member.rb', line 55 def descriptor_index @descriptor_index end |
#java_class ⇒ Object
JavaClass
49 50 51 |
# File 'lib/javaclass/member.rb', line 49 def java_class @java_class end |
#name_index ⇒ Object
名前を示すconstant_poolのインデックス
53 54 55 |
# File 'lib/javaclass/member.rb', line 53 def name_index @name_index end |
Instance Method Details
#descriptor ⇒ Object
ディスクリプタを取得する。
戻り値::ディスクリプタ
35 36 37 |
# File 'lib/javaclass/member.rb', line 35 def descriptor @java_class.get_constant_value(@descriptor_index) end |
#name ⇒ Object
名前を取得する。
戻り値::名前
27 28 29 |
# File 'lib/javaclass/member.rb', line 27 def name @java_class.get_constant_value(@name_index) end |
#to_bytes ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/javaclass/member.rb', line 38 def to_bytes() bytes = @access_flag.to_bytes() bytes += to_byte( @name_index, 2) bytes += to_byte( @descriptor_index, 2) bytes += to_byte( @attributes.size, 2) @attributes.keys.sort!.each {|k| bytes += @attributes[k].to_bytes() } return bytes end |