Class: Android::Dex::FieldInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/android/dex/info.rb

Overview

field info object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(encoded_field, field_id, dex) ⇒ FieldInfo

Returns a new instance of FieldInfo.



89
90
91
92
93
94
# File 'lib/android/dex/info.rb', line 89

def initialize(encoded_field, field_id, dex)
  @dex = dex
  @encoded_field = encoded_field
  @field_id = field_id
  @access_flags = ClassAccessFlag.new(encoded_field[:access_flags])
end

Instance Attribute Details

#access_flagsClassAccessFlag (readonly)

Returns:



81
82
83
# File 'lib/android/dex/info.rb', line 81

def access_flags
  @access_flags
end

#nameString (readonly)

Returns field name.

Returns:

  • (String)

    field name



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/android/dex/info.rb', line 79

class FieldInfo
  # @return [ClassAccessFlag]
  attr_reader :access_flags

  def name
    @dex.strings[@dex.field_ids[@field_id][:name_idx]]
  end
  def type
    @dex.type_resolve(@dex.field_ids[@field_id][:type_idx])
  end
  def initialize(encoded_field, field_id, dex)
    @dex = dex
    @encoded_field = encoded_field
    @field_id = field_id
    @access_flags = ClassAccessFlag.new(encoded_field[:access_flags])
  end

  # @return [String] field definition
  def definition
    "#{@access_flags.to_s} #{type} #{name}"
  end
end

#typeString (readonly)

Returns field type.

Returns:

  • (String)

    field type



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/android/dex/info.rb', line 79

class FieldInfo
  # @return [ClassAccessFlag]
  attr_reader :access_flags

  def name
    @dex.strings[@dex.field_ids[@field_id][:name_idx]]
  end
  def type
    @dex.type_resolve(@dex.field_ids[@field_id][:type_idx])
  end
  def initialize(encoded_field, field_id, dex)
    @dex = dex
    @encoded_field = encoded_field
    @field_id = field_id
    @access_flags = ClassAccessFlag.new(encoded_field[:access_flags])
  end

  # @return [String] field definition
  def definition
    "#{@access_flags.to_s} #{type} #{name}"
  end
end

Instance Method Details

#definitionString

Returns field definition.

Returns:

  • (String)

    field definition



97
98
99
# File 'lib/android/dex/info.rb', line 97

def definition
  "#{@access_flags.to_s} #{type} #{name}"
end