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.



108
109
110
111
112
113
# File 'lib/android/dex/info.rb', line 108

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:



100
101
102
# File 'lib/android/dex/info.rb', line 100

def access_flags
  @access_flags
end

#nameString (readonly)

Returns field name.

Returns:

  • (String)

    field name



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/android/dex/info.rb', line 98

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/android/dex/info.rb', line 98

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



116
117
118
# File 'lib/android/dex/info.rb', line 116

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