arjansh commented on a change in pull request #240: METAMODEL-1225 Add 
ColumnTypingStrategies and use them in CSV module.
URL: https://github.com/apache/metamodel/pull/240#discussion_r408829250
 
 

 ##########
 File path: 
core/src/main/java/org/apache/metamodel/schema/typing/ColumnTypingSession.java
 ##########
 @@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.metamodel.schema.typing;
+
+
+import org.apache.metamodel.schema.Column;
+import org.apache.metamodel.schema.ColumnType;
+import org.apache.metamodel.schema.Table;
+
+import java.io.Closeable;
+
+/**
+ * Represents a 'session' in which a single {@link Table}'s {@link Column}s are
+ * assigned {@link ColumnType}s.
+ */
+public interface ColumnTypingSession extends Closeable {
+
+    /**
+     * Provides the type to apply for a given column.
+     *
+     * @param ctx the context of the column naming taking place. This contains
+     *            column index, intrinsic type etc. if available.
+     * @return the type to provide to the column.
+     */
+    public ColumnType getNextColumnType( ColumnTypingContext ctx );
+
+    /**
+     * Ends the column typing session.
+     */
+    @Override
+    void close();
 
 Review comment:
   Since the `close` method is already defined on the `Closeable` interface, 
it's not necessary to define it here again. You could change this to a default 
implementation of the `close` method, i.e.:
   ```
       @Override
       default void close() {
       }
   ```
   
   In this manner you wouldn't have to implement it on the anonymous inner 
classes returned by the `startColumnTypingSession` on the 
`CustomColumnTypingStrategy` and `DefaultColumnTypingStrategy` classes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to