Class: Spark::JavaBridge::RJB

Inherits:
Base
  • Object
show all
Defined in:
lib/spark/java_bridge/rjb.rb

Constant Summary

Constants inherited from Base

Base::JAVA_OBJECTS, Base::JAVA_TEST_OBJECTS, Base::RUBY_TO_JAVA_SKIP

Instance Method Summary collapse

Methods inherited from Base

#call, #import_all, #import_all_test, #to_java, #to_java_array_list, #to_long, #to_ruby

Methods included from Helper::System

included

Constructor Details

#initialize(*args) ⇒ RJB

Returns a new instance of RJB.



11
12
13
14
15
# File 'lib/spark/java_bridge/rjb.rb', line 11

def initialize(*args)
  super
  Rjb.load(jars)
  Rjb.primitive_conversion = true
end

Instance Method Details

#import(name, klass) ⇒ Object



17
18
19
20
21
# File 'lib/spark/java_bridge/rjb.rb', line 17

def import(name, klass)
  Object.const_set(name, silence_warnings { Rjb.import(klass) })
rescue NoClassDefFoundError
  raise_missing_class(klass)
end

#java_object?(object) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/spark/java_bridge/rjb.rb', line 23

def java_object?(object)
  object.is_a?(Rjb::Rjb_JavaProxy)
end