Class: Naether::Java
- Inherits:
-
Object
- Object
- Naether::Java
- Includes:
- Singleton
- Defined in:
- lib/naether/java.rb,
lib/naether/java/ruby.rb,
lib/naether/java/jruby.rb
Defined Under Namespace
Instance Attribute Summary (collapse)
-
- (Object) java
readonly
Returns the value of attribute java.
Class Method Summary (collapse)
-
+ (java.util.ArrayList) convert_to_java_list(ruby_array)
Convert a Ruby Array to a java.util.ArrayList.
-
+ (Array) convert_to_ruby_array(java_array, to_string = false)
Convert a java,util.List to a Ruby Array.
-
+ (Hash) convert_to_ruby_hash(java_hash, to_string = false)
Convert a java.util.Map to a Ruby Hash.
-
+ (Object) create(target_class, *args)
Create a Java Object from the Naether Class Loader.
-
+ (Object) exec_static_method(target_class, target_method, params, types = nil)
Execute a Staic method on a Java class from the Naether Class Loader.
-
+ (Object) internal_load_paths(paths)
Load a path into the internal Naether ClassLoader.
- + (Object) internal_loaded_paths
-
+ (Object) load_paths(paths)
Load a path onto the parent ClassLoader.
-
+ (Array) loaded_paths
Paths loaded.
Instance Method Summary (collapse)
-
- (Java) initialize
constructor
Creates new instance by loading the Naether jar to the parent ClassLoader and creating the internal Naether ClassLoader.
Constructor Details
- (Java) initialize
Creates new instance by loading the Naether jar to the parent ClassLoader and creating the internal Naether ClassLoader
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/naether/java.rb', line 20 def initialize() naether_jar = Naether::Configuration.naether_jar unless File.exists? naether_jar raise "Cannot create Naether::Java: #{naether_jar} does not exist" end if Naether::Configuration.platform == 'java' require "#{File.dirname(__FILE__)}/java/jruby" @java = Naether::Java::JRuby.new else require "#{File.dirname(__FILE__)}/java/ruby" @java = Naether::Java::Ruby.new end end |
Instance Attribute Details
- (Object) java (readonly)
Returns the value of attribute java
14 15 16 |
# File 'lib/naether/java.rb', line 14 def java @java end |
Class Method Details
+ (java.util.ArrayList) convert_to_java_list(ruby_array)
Convert a Ruby Array to a java.util.ArrayList
94 95 96 |
# File 'lib/naether/java.rb', line 94 def self.convert_to_java_list( ruby_array ) instance.java.convert_to_java_list( ruby_array ) end |
+ (Array) convert_to_ruby_array(java_array, to_string = false)
Convert a java,util.List to a Ruby Array
105 106 107 |
# File 'lib/naether/java.rb', line 105 def self.convert_to_ruby_array( java_array, to_string = false ) instance.java.convert_to_ruby_array( java_array, to_string ) end |
+ (Hash) convert_to_ruby_hash(java_hash, to_string = false)
Convert a java.util.Map to a Ruby Hash
116 117 118 |
# File 'lib/naether/java.rb', line 116 def self.convert_to_ruby_hash( java_hash, to_string = false ) instance.java.convert_to_ruby_hash( java_hash, to_string ) end |
+ (Object) create(target_class, *args)
Create a Java Object from the Naether Class Loader
72 73 74 |
# File 'lib/naether/java.rb', line 72 def self.create( target_class, *args ) instance.java.create( target_class, *args ) end |
+ (Object) exec_static_method(target_class, target_method, params, types = nil)
Execute a Staic method on a Java class from the Naether Class Loader
84 85 86 |
# File 'lib/naether/java.rb', line 84 def self.exec_static_method( target_class, target_method, params, types = nil ) instance.java.exec_static_method( target_class, target_method, params, types ) end |
+ (Object) internal_load_paths(paths)
Load a path into the internal Naether ClassLoader
63 64 65 |
# File 'lib/naether/java.rb', line 63 def self.internal_load_paths(paths) instance.java.internal_load_paths(paths) end |
+ (Object) internal_loaded_paths
54 55 56 |
# File 'lib/naether/java.rb', line 54 def self.internal_loaded_paths convert_to_ruby_array( instance.java.class_loader.getLoadedPaths, true ) end |
+ (Object) load_paths(paths)
Load a path onto the parent ClassLoader
50 51 52 |
# File 'lib/naether/java.rb', line 50 def self.load_paths(paths) instance.java.load_paths(paths) end |
+ (Array) loaded_paths
Paths loaded
41 42 43 |
# File 'lib/naether/java.rb', line 41 def self.loaded_paths instance.java.loaded_paths end |