[#2829] Enhance Loader API to allow for importing JSON data in addition to CSV data - Fixed warnings

This commit is contained in:
Lukas Eder 2013-11-04 10:44:41 +01:00
parent 44597edcdb
commit 4ea1428d8c
12 changed files with 21 additions and 13 deletions

View File

@ -47,12 +47,13 @@ package org.jooq;
* optional CSV loader options.
*
* @author Lukas Eder
* @author Johannes Bühler
*/
public interface LoaderJSONOptionsStep<R extends TableRecord<R>> extends LoaderLoadStep<R> {
/**
* Specify that a certain number of rows should be ignored from the CSV
* file. This is useful for skipping processing information
* Specify that a certain number of rows should be ignored from the JSON
* input. This is useful for skipping processing information
* <p>
* By default, this is set to <code>1</code>, as CSV files are expected to
* hold a header row.
@ -62,7 +63,6 @@ public interface LoaderJSONOptionsStep<R extends TableRecord<R>> extends LoaderL
@Support
LoaderJSONOptionsStep<R> ignoreRows(int number);
/**
* Specify the input string representation of <code>NULL</code>.
* <p>

View File

@ -45,10 +45,11 @@ import java.util.Collection;
/**
* The <code>Loader</code> API is used for configuring data loads.
* <p>
* The step in constructing the {@link org.jooq.Loader} object where you can set the
* mandatory JSON loader options.
* The step in constructing the {@link org.jooq.Loader} object where you can set
* the mandatory JSON loader options.
*
* @author Lukas Eder
* @author Johannes Bühler
*/
public interface LoaderJSONStep<R extends TableRecord<R>> {

View File

@ -40,13 +40,13 @@
*/
package org.jooq;
import org.xml.sax.InputSource;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.Reader;
import org.xml.sax.InputSource;
/**
* The <code>Loader</code> API is used for configuring data loads.
* <p>
@ -54,6 +54,7 @@ import java.io.Reader;
* load type and data source.
*
* @author Lukas Eder
* @author Johannes Bühler
*/
public interface LoaderSourceStep<R extends TableRecord<R>> {

View File

@ -6,10 +6,11 @@ import java.util.Map;
/**
* Container factory for creating containers for JSON object and JSON array.
*
* @see org.json.simple.parser.JSONParser#parse(java.io.Reader, ContainerFactory)
* @see JSONParser#parse(java.io.Reader, ContainerFactory)
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
@SuppressWarnings({ "rawtypes" })
public interface ContainerFactory {
/**
* @return A Map instance to store JSON object, or null if you want to use org.json.simple.JSONObject.

View File

@ -6,7 +6,7 @@ import java.io.IOException;
* A simplified and stoppable SAX-like content handler for stream processing of JSON text.
*
* @see org.xml.sax.ContentHandler
* @see org.json.simple.parser.JSONParser#parse(java.io.Reader, ContentHandler, boolean)
* @see JSONParser#parse(java.io.Reader, ContentHandler, boolean)
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*/

View File

@ -32,9 +32,9 @@ import java.util.List;
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
@SuppressWarnings({ "serial", "rawtypes", "unchecked" })
public class JSONArray extends ArrayList {
/**
* Constructs an empty JSONArray.
*/

View File

@ -32,6 +32,7 @@ import java.util.Map;
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
@SuppressWarnings({ "serial", "rawtypes", "unchecked" })
public class JSONObject extends HashMap{

View File

@ -13,6 +13,7 @@ import java.util.Map;
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*/
@SuppressWarnings({ "hiding", "javadoc", "rawtypes", "unchecked" })
public class JSONParser {
public static final int S_INIT=0;
public static final int S_IN_FINISHED_VALUE=1;//string,number,boolean,null,object,array

View File

@ -9,6 +9,7 @@ import java.util.List;
/**
* A very simple JSON reader based on Simple JSON.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class JSONReader implements Closeable {
@ -20,7 +21,6 @@ public class JSONReader implements Closeable {
this.parser = new JSONParser();
}
@SuppressWarnings("unchecked")
public List<String[]> readAll() throws IOException {
List<String[]> all;
try {

View File

@ -40,7 +40,7 @@ public class ParseException extends Exception {
}
/**
* @see org.json.simple.parser.JSONParser#getPosition()
* @see JSONParser#getPosition()
*
* @return The character position (starting with 0) of the input where the error occurs.
*/
@ -53,7 +53,7 @@ public class ParseException extends Exception {
}
/**
* @see org.json.simple.parser.Yytoken
* @see Yytoken
*
* @return One of the following base on the value of errorType:
* ERROR_UNEXPECTED_CHAR java.lang.Character
@ -68,6 +68,7 @@ public class ParseException extends Exception {
this.unexpectedObject = unexpectedObject;
}
@Override
public String getMessage() {
StringBuffer sb = new StringBuffer();

View File

@ -1,5 +1,6 @@
package org.jooq.tools.json;
@SuppressWarnings("unused")
class Yylex {
/** This character denotes the end of file */

View File

@ -18,6 +18,7 @@ public class Yytoken {
this.value=value;
}
@Override
public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){