src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java in embulk-output-jdbc-0.4.0 vs src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java in embulk-output-jdbc-0.4.1
- old
+ new
@@ -1,96 +1,96 @@
-package org.embulk.output.jdbc.setter;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import org.embulk.spi.Column;
-import org.embulk.spi.ColumnVisitor;
-import org.embulk.spi.PageReader;
-import org.embulk.spi.time.Timestamp;
-
-public class ColumnSetterVisitor
- implements ColumnVisitor
-{
- private final PageReader pageReader;
- private final ColumnSetter setter;
-
- public ColumnSetterVisitor(PageReader pageReader, ColumnSetter setter)
- {
- this.pageReader = pageReader;
- this.setter = setter;
- }
-
- @Override
- public void booleanColumn(Column column)
- {
- try {
- if (pageReader.isNull(column)) {
- setter.nullValue();
- } else {
- setter.booleanValue(pageReader.getBoolean(column));
- }
- } catch (IOException | SQLException ex) {
- // TODO exception class
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void longColumn(Column column)
- {
- try {
- if (pageReader.isNull(column)) {
- setter.nullValue();
- } else {
- setter.longValue(pageReader.getLong(column));
- }
- } catch (IOException | SQLException ex) {
- // TODO exception class
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void doubleColumn(Column column)
- {
- try {
- if (pageReader.isNull(column)) {
- setter.nullValue();
- } else {
- setter.doubleValue(pageReader.getDouble(column));
- }
- } catch (IOException | SQLException ex) {
- // TODO exception class
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void stringColumn(Column column)
- {
- try {
- if (pageReader.isNull(column)) {
- setter.nullValue();
- } else {
- setter.stringValue(pageReader.getString(column));
- }
- } catch (IOException | SQLException ex) {
- // TODO exception class
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void timestampColumn(Column column)
- {
- try {
- if (pageReader.isNull(column)) {
- setter.nullValue();
- } else {
- setter.timestampValue(pageReader.getTimestamp(column));
- }
- } catch (IOException | SQLException ex) {
- // TODO exception class
- throw new RuntimeException(ex);
- }
- }
-}
+package org.embulk.output.jdbc.setter;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import org.embulk.spi.Column;
+import org.embulk.spi.ColumnVisitor;
+import org.embulk.spi.PageReader;
+import org.embulk.spi.time.Timestamp;
+
+public class ColumnSetterVisitor
+ implements ColumnVisitor
+{
+ private final PageReader pageReader;
+ private final ColumnSetter setter;
+
+ public ColumnSetterVisitor(PageReader pageReader, ColumnSetter setter)
+ {
+ this.pageReader = pageReader;
+ this.setter = setter;
+ }
+
+ @Override
+ public void booleanColumn(Column column)
+ {
+ try {
+ if (pageReader.isNull(column)) {
+ setter.nullValue();
+ } else {
+ setter.booleanValue(pageReader.getBoolean(column));
+ }
+ } catch (IOException | SQLException ex) {
+ // TODO exception class
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public void longColumn(Column column)
+ {
+ try {
+ if (pageReader.isNull(column)) {
+ setter.nullValue();
+ } else {
+ setter.longValue(pageReader.getLong(column));
+ }
+ } catch (IOException | SQLException ex) {
+ // TODO exception class
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public void doubleColumn(Column column)
+ {
+ try {
+ if (pageReader.isNull(column)) {
+ setter.nullValue();
+ } else {
+ setter.doubleValue(pageReader.getDouble(column));
+ }
+ } catch (IOException | SQLException ex) {
+ // TODO exception class
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public void stringColumn(Column column)
+ {
+ try {
+ if (pageReader.isNull(column)) {
+ setter.nullValue();
+ } else {
+ setter.stringValue(pageReader.getString(column));
+ }
+ } catch (IOException | SQLException ex) {
+ // TODO exception class
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public void timestampColumn(Column column)
+ {
+ try {
+ if (pageReader.isNull(column)) {
+ setter.nullValue();
+ } else {
+ setter.timestampValue(pageReader.getTimestamp(column));
+ }
+ } catch (IOException | SQLException ex) {
+ // TODO exception class
+ throw new RuntimeException(ex);
+ }
+ }
+}