private int getPathMatches(List<String> newPath) { int pathMatches = 0; for (int i = 0; i < currentPath.size() && i < newPath.size(); i++) { JsonRecordSupport.PathPart lastPart = currentPath.get(i); if (lastPart.getPath().equals(newPath.get(i)) || (lastPart.isArray() && newPath.get(i).charAt(0) == ARRAY_VALUE_PREFIX)) { // NOPMD, false positive pathMatches++; } else { break; } } return pathMatches; }
String last = newPath.get(newPath.size() - 1); int idx = JsonRecordSupport.toArrayIndex(last); while (idx > pathPart.getIdx()) { pathPart.incrementIdx(); jg.writeNull(); pathPart.incrementIdx();
String last = newPath.get(newPath.size() - 1); int idx = JsonRecordSupport.toArrayIndex(last); while (idx > pathPart.getIdx()) { pathPart.incrementIdx(); jg.writeNull(); pathPart.incrementIdx();
boolean nextArray = nextPart.charAt(0) == ARRAY_VALUE_PREFIX; JsonRecordSupport.PathPart pathPart = new JsonRecordSupport.PathPart(part, nextArray); currentPath.add(pathPart); while (idx > pathPart.getIdx()) { pathPart.incrementIdx(); jg.writeNull();
boolean nextArray = nextPart.startsWith("["); JsonRecordSupport.PathPart pathPart = new JsonRecordSupport.PathPart(part, nextArray); currentPath.add(pathPart); while (idx > pathPart.getIdx()) { pathPart.incrementIdx(); jg.writeNull();
private int getPathMatches(List<String> newPath) { int pathMatches = 0; for (int i = 0; i < currentPath.size() && i < newPath.size(); i++) { JsonRecordSupport.PathPart lastPart = currentPath.get(i); if (lastPart.getPath().equals(newPath.get(i)) || (lastPart.isArray() && newPath.get(i).startsWith("["))) { pathMatches++; } else { break; } } return pathMatches; }
private void closeDownStructs(int pathMatches) throws IOException { int count = currentPath.size() - pathMatches; for (int i = 0; i < count; i++) { if (currentPath.removeLast().isArray()) { jg.writeEndArray(); } else { jg.writeEndObject(); } } }
private void closeDownStructs(int pathMatches) throws IOException { int count = currentPath.size() - pathMatches; for (int i = 0; i < count; i++) { if (currentPath.removeLast().isArray()) { jg.writeEndArray(); } else { jg.writeEndObject(); } } }