Module: Embulk::Type

Defined in:
lib/embulk/column.rb

Class Method Summary collapse

Class Method Details

.from_java(java_type) ⇒ Object



24
25
26
# File 'lib/embulk/column.rb', line 24

def self.from_java(java_type)
  java_type.getName.to_sym
end

.new_java_type(ruby_type) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/embulk/column.rb', line 28

def self.new_java_type(ruby_type)
  case ruby_type
  when :boolean
    Java::Types::BOOLEAN
  when :long
    Java::Types::LONG
  when :double
    Java::Types::DOUBLE
  when :string
    Java::Types::STRING
  when :timestamp
    Java::Types::TIMESTAMP
  else
    raise ArgumentError, "Unknown type #{ruby_type.inspect}: supported types are :boolean, :long, :double, :string and :timestamp"
  end
end