From be954268675c296ae70d33d48f1d4b9852e05c1b Mon Sep 17 00:00:00 2001 From: Mike Pigott Date: Wed, 30 Jan 2019 00:11:50 -0500 Subject: [PATCH] ARROW-3965: JDBC-To-Arrow Config Builder javadocs. --- .../jdbc/JdbcToArrowConfigBuilder.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowConfigBuilder.java b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowConfigBuilder.java index 54b6a7a649846..df97c3a975196 100644 --- a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowConfigBuilder.java +++ b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowConfigBuilder.java @@ -23,13 +23,38 @@ import com.google.common.base.Preconditions; +/** + * This class builds {@link JdbcToArrowConfig}s. + */ public class JdbcToArrowConfigBuilder { private Calendar calendar; private BaseAllocator allocator; + /** + * Default constructor for the JdbcToArrowConfigBuilder}. + * Use the setter methods for the allocator and calendar; both must be + * set. Otherwise, {@link #build()} will throw a {@link NullPointerException}. + */ public JdbcToArrowConfigBuilder() { + this.allocator = null; + this.calendar = null; } + /** + * Constructor for the JdbcToArrowConfigBuilder. Both the + * allocator and calendar are required. A {@link NullPointerException} + * will be thrown if one of the arguments is null. + *

+ * The allocator is used to construct Arrow vectors from the JDBC ResultSet. + * The calendar is used to determine the time zone of {@link java.sql.Timestamp} + * fields and convert {@link java.sql.Date}, {@link java.sql.Time}, and + * {@link java.sql.Timestamp} fields to a single, common time zone when reading + * from the result set. + *

+ * + * @param allocator The Arrow Vector memory allocator. + * @param calendar The calendar to use when constructing timestamp fields. + */ public JdbcToArrowConfigBuilder(BaseAllocator allocator, Calendar calendar) { this(); @@ -65,6 +90,13 @@ public JdbcToArrowConfigBuilder setCalendar(Calendar calendar) { return this; } + /** + * This builds the {@link JdbcToArrowConfig} from the provided + * {@link BaseAllocator} and {@link Calendar}. + * + * @return The built {@link JdbcToArrowConfig} + * @throws NullPointerException if either the allocator or calendar was not set. + */ public JdbcToArrowConfig build() { return new JdbcToArrowConfig(allocator, calendar); }