Module: Jruby::Coercion

Defined in:
lib/jruby-coercion.rb,
lib/jruby-coercion/version.rb

Defined Under Namespace

Modules: Coercable Classes: Registry

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.alternative_class(java_type) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/jruby-coercion.rb', line 16

def self.alternative_class(java_type)
  if native_type?(java_type)
    return java_type.ruby_class
  else
    return java_type.java_class
  end
end

.native_type?(java_type) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/jruby-coercion.rb', line 8

def self.native_type?(java_type)
  java_type.class == Java::JavaClass
end

.ruby_type?(java_type) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/jruby-coercion.rb', line 12

def self.ruby_type?(java_type)
  java_type.class == Class
end