Module: Embulk::Type

Defined in:
embulk-core/src/main/ruby/embulk/column.rb

Class Method Summary collapse

Class Method Details

.from_java(java_type) ⇒ Object



44
45
46
# File 'embulk-core/src/main/ruby/embulk/column.rb', line 44

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

.new_java_type(ruby_type) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'embulk-core/src/main/ruby/embulk/column.rb', line 48

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
  when :json
    Java::Types::JSON
  else
    raise ArgumentError, "Unknown type #{ruby_type.inspect}: supported types are :boolean, :long, :double, :string and :timestamp"
  end
end