Class: Naether::Java

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/naether/java.rb,
lib/naether/java/ruby.rb,
lib/naether/java/jruby.rb

Defined Under Namespace

Classes: JRuby, Ruby

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Java) initialize

A new instance of Java



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/naether/java.rb', line 18

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.instance
  else
    require "#{File.dirname(__FILE__)}/java/ruby"
    @java = Naether::Java::Ruby.instance
  end
end

Instance Attribute Details

- (Object) java (readonly)

Returns the value of attribute java



16
17
18
# File 'lib/naether/java.rb', line 16

def java
  @java
end

Class Method Details

+ (Object) convert_to_java_list(ruby_array)



57
58
59
# File 'lib/naether/java.rb', line 57

def self.convert_to_java_list( ruby_array )
  instance.java.convert_to_java_list( ruby_array )
end

+ (Object) convert_to_ruby_array(java_array, to_string = false)



61
62
63
# File 'lib/naether/java.rb', line 61

def self.convert_to_ruby_array( java_array, to_string = false )
  instance.java.convert_to_ruby_array( java_array, to_string )
end

+ (Object) convert_to_ruby_hash(java_hash, to_string = false)



65
66
67
# File 'lib/naether/java.rb', line 65

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)



49
50
51
# File 'lib/naether/java.rb', line 49

def self.create( target_class, *args )
  instance.java.create( target_class, *args )
end

+ (Object) exec_static_method(target_class, target_method, *args)



53
54
55
# File 'lib/naether/java.rb', line 53

def self.exec_static_method( target_class, target_method, *args ) 
  instance.java.exec_static_method( target_class, target_method, *args )
end

+ (Object) internal_load_paths(paths)

Load paths for the runtime platform



45
46
47
# File 'lib/naether/java.rb', line 45

def self.internal_load_paths(paths)
  instance.java.internal_load_paths(paths)
end

+ (Object) load_paths(paths)

Load paths for the runtime platform



40
41
42
# File 'lib/naether/java.rb', line 40

def self.load_paths(paths)
  instance.java.load_paths(paths)
end

+ (Object) loaded_paths

Paths loaded



35
36
37
# File 'lib/naether/java.rb', line 35

def self.loaded_paths
  instance.java.loaded_paths
end