class Android::Dex::MethodInfo

method info object @!attribute [r] name

@return [String] method name

@!attribute [r] ret_type

@return [String] return type of the method

@!attribute [r] parameters

@return [Array<String>] method parameters

Attributes

access_flags[R]

@return [MethodAccessFlag]

Public Class Methods

new(encoded_method, method_id, dex) click to toggle source
# File lib/android/dex/info.rb, line 115
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

Public Instance Methods

code_item() click to toggle source

@return [DexObject::CodeItem]

# File lib/android/dex/info.rb, line 142
def code_item
  @encoded_method.code_item
end
definition() click to toggle source

@return [String] method definition string

# File lib/android/dex/info.rb, line 137
def definition
  "#{access_flags.to_s} #{ret_type} #{name}(#{parameters.join(', ')});"
end
name() click to toggle source
# File lib/android/dex/info.rb, line 121
def name
  @dex.strings[@dex.method_ids[@method_id][:name_idx]]
end
parameters() click to toggle source
# File lib/android/dex/info.rb, line 127
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
ret_type() click to toggle source
# File lib/android/dex/info.rb, line 124
def ret_type
  @dex.type_resolve(proto[:return_type_idx])
end

Private Instance Methods

proto() click to toggle source
# File lib/android/dex/info.rb, line 147
def proto
  @dex.proto_ids[@dex.method_ids[@method_id][:proto_idx]]
end