Sha256: 313462f798f2bb9278f51fc5eef9e431ab47b009bb6f03a7ff086ec5faeb1fda

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

require 'rasm/java/accessable'
module Rasm
  module Java

    class FieldInfo
      include Accessable
      attr_reader :descriptor, :attributes
      def initialize(descriptor, attributes)
        @descriptor, @attributes = descriptor, attributes
      end

      def to_s
        access = access_flags
        str = ''
        str << "\t// DEPRECATED\n" if access & ACC_DEPRECATED != 0
        str << "\t// access flags 0x%x\n" % access
        signature, constant_value = attribute_of('Signature'), attribute_of('ConstantValue')
        if signature
          str << "\t#{access_desc} #{typeof(signature.value)} #{name}"
        else
          str << "\t#{access_desc} #{typeof(descriptor)} #{name}"
        end
        str << " = #{constant_value.value}" if constant_value

        str
      end

      def attribute_of(name)
        attributes.detect{|attr| attr.name == name}
      end

    end

    MethodInfo = Struct.new(:access_flags, :name, :descriptor, :attributes) do

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rasm-0.0.1 lib/rasm/java/structure.rb