Class: Android::Dex::MethodInfo
- Inherits:
-
Object
- Object
- Android::Dex::MethodInfo
- Defined in:
- lib/android/dex/info.rb
Overview
method info object
Instance Attribute Summary collapse
- #access_flags ⇒ MethodAccessFlag readonly
-
#name ⇒ String
readonly
Method name.
-
#parameters ⇒ Array<String>
readonly
Method parameters.
-
#ret_type ⇒ String
readonly
Return type of the method.
Instance Method Summary collapse
- #code_item ⇒ DexObject::CodeItem
-
#definition ⇒ String
Method definition string.
-
#initialize(encoded_method, method_id, dex) ⇒ MethodInfo
constructor
A new instance of MethodInfo.
Constructor Details
#initialize(encoded_method, method_id, dex) ⇒ MethodInfo
Returns a new instance of MethodInfo.
113 114 115 116 117 118 |
# File 'lib/android/dex/info.rb', line 113 def initialize(encoded_method, method_id, dex) @encoded_method = encoded_method @method_id = method_id @dex = dex @access_flags = MethodAccessFlag.new(encoded_method[:access_flags]) end |
Instance Attribute Details
#access_flags ⇒ MethodAccessFlag (readonly)
111 112 113 |
# File 'lib/android/dex/info.rb', line 111 def access_flags @access_flags end |
#name ⇒ String (readonly)
Returns method name.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/android/dex/info.rb', line 109 class MethodInfo # @return [MethodAccessFlag] attr_reader :access_flags def initialize(encoded_method, method_id, dex) @encoded_method = encoded_method @method_id = method_id @dex = dex @access_flags = MethodAccessFlag.new(encoded_method[:access_flags]) end def name @dex.strings[@dex.method_ids[@method_id][:name_idx]] end def ret_type @dex.type_resolve(proto[:return_type_idx]) end def parameters unless proto[:parameters_off] == 0 list = DexObject::TypeList.new(@dex.data, proto[:parameters_off]) list[:list].map { |item| @dex.type_resolve(item) } else [] end end # @return [String] method definition string def definition "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});" end # @return [DexObject::CodeItem] def code_item @encoded_method.code_item end private def proto @dex.proto_ids[@dex.method_ids[@method_id][:proto_idx]] end end |
#parameters ⇒ Array<String> (readonly)
Returns method parameters.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/android/dex/info.rb', line 109 class MethodInfo # @return [MethodAccessFlag] attr_reader :access_flags def initialize(encoded_method, method_id, dex) @encoded_method = encoded_method @method_id = method_id @dex = dex @access_flags = MethodAccessFlag.new(encoded_method[:access_flags]) end def name @dex.strings[@dex.method_ids[@method_id][:name_idx]] end def ret_type @dex.type_resolve(proto[:return_type_idx]) end def parameters unless proto[:parameters_off] == 0 list = DexObject::TypeList.new(@dex.data, proto[:parameters_off]) list[:list].map { |item| @dex.type_resolve(item) } else [] end end # @return [String] method definition string def definition "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});" end # @return [DexObject::CodeItem] def code_item @encoded_method.code_item end private def proto @dex.proto_ids[@dex.method_ids[@method_id][:proto_idx]] end end |
#ret_type ⇒ String (readonly)
Return type of the method
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/android/dex/info.rb', line 109 class MethodInfo # @return [MethodAccessFlag] attr_reader :access_flags def initialize(encoded_method, method_id, dex) @encoded_method = encoded_method @method_id = method_id @dex = dex @access_flags = MethodAccessFlag.new(encoded_method[:access_flags]) end def name @dex.strings[@dex.method_ids[@method_id][:name_idx]] end def ret_type @dex.type_resolve(proto[:return_type_idx]) end def parameters unless proto[:parameters_off] == 0 list = DexObject::TypeList.new(@dex.data, proto[:parameters_off]) list[:list].map { |item| @dex.type_resolve(item) } else [] end end # @return [String] method definition string def definition "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});" end # @return [DexObject::CodeItem] def code_item @encoded_method.code_item end private def proto @dex.proto_ids[@dex.method_ids[@method_id][:proto_idx]] end end |
Instance Method Details
#code_item ⇒ DexObject::CodeItem
140 141 142 |
# File 'lib/android/dex/info.rb', line 140 def code_item @encoded_method.code_item end |
#definition ⇒ String
Returns method definition string.
135 136 137 |
# File 'lib/android/dex/info.rb', line 135 def definition "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});" end |