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
132 133 134 135 136 137 |
# File 'lib/android/dex/info.rb', line 132 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)
130 131 132 |
# File 'lib/android/dex/info.rb', line 130 def access_flags @access_flags end |
#name ⇒ String (readonly)
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/android/dex/info.rb', line 128 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)
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/android/dex/info.rb', line 128 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)
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/android/dex/info.rb', line 128 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
159 160 161 |
# File 'lib/android/dex/info.rb', line 159 def code_item @encoded_method.code_item end |
#definition ⇒ String
154 155 156 |
# File 'lib/android/dex/info.rb', line 154 def definition "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});" end |