fixing typos in javadocs

This commit is contained in:
Noble Paul 2016-05-31 23:12:09 +05:30
parent 032247ff6e
commit d33381ef49
1 changed files with 19 additions and 19 deletions

View File

@ -94,9 +94,9 @@ public class JsonRecordReader {
List<String> paths = splitEscapeQuote(path); List<String> paths = splitEscapeQuote(path);
if (paths.size() == 0) { if (paths.size() == 0) {
if (isRecord) rootNode.isRecord = true; if (isRecord) rootNode.isRecord = true;
return;//the patrh is "/" return;//the path is "/"
} }
// deal with how split behaves when seperator starts a string! // deal with how split behaves when separator starts with an empty string!
if ("".equals(paths.get(0).trim())) if ("".equals(paths.get(0).trim()))
paths.remove(0); paths.remove(0);
rootNode.build(paths, fieldName, multiValued, isRecord, path); rootNode.build(paths, fieldName, multiValued, isRecord, path);
@ -136,7 +136,7 @@ public class JsonRecordReader {
public void streamRecords(JSONParser parser, Handler handler) throws IOException { public void streamRecords(JSONParser parser, Handler handler) throws IOException {
rootNode.parse(parser, handler, rootNode.parse(parser, handler,
new LinkedHashMap<String, Object>()); new LinkedHashMap<>());
} }
@ -178,7 +178,7 @@ public class JsonRecordReader {
/** /**
* Walk the Node tree propagating any wildDescentant information to * Walk the Node tree propagating any wild Descendant information to
* child nodes. * child nodes.
*/ */
private void buildOptimize() { private void buildOptimize() {
@ -191,7 +191,7 @@ public class JsonRecordReader {
static final String RECURSIVE_WILDCARD_PATH = "**"; static final String RECURSIVE_WILDCARD_PATH = "**";
/** /**
* Build a Node tree structure representing all paths of intrest to us. * Build a Node tree structure representing all paths of interest to us.
* This must be done before parsing of the JSON stream starts. Each node * This must be done before parsing of the JSON stream starts. Each node
* holds one portion of an path. Taking each path segment in turn this * holds one portion of an path. Taking each path segment in turn this
* method walks the Node tree and finds where the new segment should be * method walks the Node tree and finds where the new segment should be
@ -214,7 +214,7 @@ public class JsonRecordReader {
if (paths.isEmpty()) { if (paths.isEmpty()) {
// We have emptied paths, we are for the moment a leaf of the tree. // We have emptied paths, we are for the moment a leaf of the tree.
// When parsing the actual input we have traversed to a position // When parsing the actual input we have traversed to a position
// where we actutally have to do something. getOrAddNode() will // where we actually have to do something. getOrAddNode() will
// have created and returned a new minimal Node with name and // have created and returned a new minimal Node with name and
// pathName already populated. We need to add more information. // pathName already populated. We need to add more information.
if (record) { if (record) {
@ -284,13 +284,13 @@ public class JsonRecordReader {
event = parser.nextEvent(); event = parser.nextEvent();
if (event == EOF) break; if (event == EOF) break;
if (event == OBJECT_START) { if (event == OBJECT_START) {
handleObjectStart(parser, handler, values, new Stack<Set<String>>(), recordStarted, null); handleObjectStart(parser, handler, values, new Stack<>(), recordStarted, null);
} else if (event == ARRAY_START) { } else if (event == ARRAY_START) {
for (; ; ) { for (; ; ) {
event = parser.nextEvent(); event = parser.nextEvent();
if (event == ARRAY_END) break; if (event == ARRAY_END) break;
if (event == OBJECT_START) { if (event == OBJECT_START) {
handleObjectStart(parser, handler, values, new Stack<Set<String>>(), recordStarted, null); handleObjectStart(parser, handler, values, new Stack<>(), recordStarted, null);
} }
} }
} }
@ -300,14 +300,14 @@ public class JsonRecordReader {
/** /**
* If a new tag is encountered, check if it is of interest or not by seeing * If a new tag is encountered, check if it is of interest or not by seeing
* if it matches against our node tree. If we have deperted from the node * if it matches against our node tree. If we have departed from the node
* tree then walk back though the tree's ancestor nodes checking to see if * tree then walk back though the tree's ancestor nodes checking to see if
* any // expressions exist for the node and compare them against the new * any // expressions exist for the node and compare them against the new
* tag. If matched then "jump" to that node, otherwise ignore the tag. * tag. If matched then "jump" to that node, otherwise ignore the tag.
* <p> * <p>
* Note, the list of // expressions found while walking back up the tree * Note, the list of // expressions found while walking back up the tree
* is chached in the HashMap decends. Then if the new tag is to be skipped, * is cached in the HashMap descendants. Then if the new tag is to be skipped,
* any inner chil tags are compared against the cache and jumped to if * any inner child tags are compared against the cache and jumped to if
* matched. * matched.
*/ */
private void handleObjectStart(final JSONParser parser, private void handleObjectStart(final JSONParser parser,
@ -320,7 +320,7 @@ public class JsonRecordReader {
Set<String> valuesAddedinThisFrame = null; Set<String> valuesAddedinThisFrame = null;
if (isRecord || !recordStarted) { if (isRecord || !recordStarted) {
// This Node is a match for an PATH from a forEach attribute, // This Node is a match for an PATH from a forEach attribute,
// prepare for the clean up that will occurr when the record // prepare for the clean up that will occur when the record
// is emitted after its END_ELEMENT is matched // is emitted after its END_ELEMENT is matched
valuesAddedinThisFrame = new HashSet<>(); valuesAddedinThisFrame = new HashSet<>();
stack.push(valuesAddedinThisFrame); stack.push(valuesAddedinThisFrame);
@ -390,7 +390,7 @@ public class JsonRecordReader {
new Wrapper(node, frameWrapper, name).walk(event); new Wrapper(node, frameWrapper, name).walk(event);
} }
} else { } else {
//this is not something we are interested in . skip it //this is not something we are interested in. Skip it
event = parser.nextEvent(); event = parser.nextEvent();
if (event == STRING || if (event == STRING ||
event == LONG || event == LONG ||
@ -459,19 +459,19 @@ public class JsonRecordReader {
/** /**
* The path is split into segments using the '/' as a seperator. However * The path is split into segments using the '/' as a separator. However
* this method deals with special cases where there is a slash '/' character * this method deals with special cases where there is a slash '/' character
* inside the attribute value e.g. x/@html='text/html'. We split by '/' but * inside the attribute value e.g. x/@html='text/html'. We split by '/' but
* then reassemble things were the '/' appears within a quoted sub-string. * then reassemble things were the '/' appears within a quoted sub-string.
* <p> * <p>
* We have already enforced that the string must begin with a seperator. This * We have already enforced that the string must begin with a separator. This
* method depends heavily on how split behaves if the string starts with the * method depends heavily on how split behaves if the string starts with the
* seperator or if a sequence of multiple seperator's appear. * seperator or if a sequence of multiple separators appear.
*/ */
private static List<String> splitEscapeQuote(String str) { private static List<String> splitEscapeQuote(String str) {
List<String> result = new LinkedList<>(); List<String> result = new LinkedList<>();
String[] ss = str.split("/"); String[] ss = str.split("/");
for (int i = 0; i < ss.length; i++) { // i=1: skip seperator at start of string for (int i = 0; i < ss.length; i++) { // i=1: skip separator at start of string
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int quoteCount = 0; int quoteCount = 0;
while (true) { while (true) {
@ -493,7 +493,7 @@ public class JsonRecordReader {
/** /**
* Implement this interface to stream records as and when one is found. * Implement this interface to stream records as and when one is found.
*/ */
public static interface Handler { public interface Handler {
/** /**
* @param record The record map. The key is the field name as provided in * @param record The record map. The key is the field name as provided in
* the addField() methods. The value can be a single String (for single * the addField() methods. The value can be a single String (for single
@ -502,7 +502,7 @@ public class JsonRecordReader {
* If there is any change all parsing will be aborted and the Exception * If there is any change all parsing will be aborted and the Exception
* is propagated up * is propagated up
*/ */
public void handle(Map<String, Object> record, String path); void handle(Map<String, Object> record, String path);
} }
public static Object parseSingleFieldValue(int ev, JSONParser parser, MethodFrameWrapper runnable) throws IOException { public static Object parseSingleFieldValue(int ev, JSONParser parser, MethodFrameWrapper runnable) throws IOException {