Module: Jruby::Coercion::Coercable

Included in:
Numeric
Defined in:
lib/jruby-coercion.rb

Instance Method Summary collapse

Instance Method Details

#to_java(java_type = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/jruby-coercion.rb', line 25

def to_java(java_type = nil)
  return super if java_type.nil?
  converter = ::Jruby::Coercion::Registry.registry_converts_class_and_to?(self.class, java_type)

  if converter
    return converter.call(self)
  else
    super
  end
end