Class: Android::JavaClass

Inherits:
JavaClass show all
Defined in:
lib/android/javaclass.rb

Overview

represents a .java class file

we’re using VERY rudimentary parsing of the .java source code, at the moment.

we need to eventually write a much more intelligent .java parser or, ideally, find a well-written .java parser to take advantage of

Direct Known Subclasses

Activity

Instance Attribute Summary

Attributes inherited from JavaClass

#file_path

Class Method Summary collapse

Methods inherited from JavaClass

#class_name, #initialize, #package_name, parse, #source_code, #source_code_without_comments, #super_class

Constructor Details

This class inherits a constructor from JavaClass

Class Method Details

.find_all(directory) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/android/javaclass.rb', line 12

def self.find_all directory
  Dir[ File.join(directory, '**', '*.java') ].map do |file_path|
    java = JavaClass.new file_path
    # if a the .java class 'extends Foo' and there's a class called 
    # Android::Foo, we initialize an Android::Foo, else we initialize
    # a generic Android::JavaClass
    if java.superclass && Android.const_defined?(java.superclass.to_sym)
      Android.const_get(java.superclass).new file_path
    else
      Android::JavaClass.new file_path
    end
  end
end