protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected static JsonPointer _parseTail(String input) { final int end = input.length(); // first char is the contextual slash, skip for (int i = 1; i < end; ) { char c = input.charAt(i); if (c == '/') { // common case, got a segment return new JsonPointer(input, input.substring(1, i), _parseTail(input.substring(i))); } ++i; // quoting is different; offline this case if (c == '~' && i < end) { // possibly, quote return _parseQuotedTail(input, i); } // otherwise, loop on } // end of the road, no escapes return new JsonPointer(input, input.substring(1), EMPTY); }
protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
/** * Method called to parse tail of pointer path, when a potentially * escaped character has been seen. * * @param input Full input for the tail being parsed * @param i Offset to character after tilde */ protected static JsonPointer _parseQuotedTail(String input, int i) { final int end = input.length(); StringBuilder sb = new StringBuilder(Math.max(16, end)); if (i > 2) { sb.append(input, 1, i-1); } _appendEscape(sb, input.charAt(i++)); while (i < end) { char c = input.charAt(i); if (c == '/') { // end is nigh! return new JsonPointer(input, sb.toString(), _parseTail(input.substring(i))); } ++i; if (c == '~' && i < end) { _appendEscape(sb, input.charAt(i++)); continue; } sb.append(c); } // end of the road, last segment return new JsonPointer(input, sb.toString(), EMPTY); }
protected static JsonPointer _parseTail(String input) { final int end = input.length(); // first char is the contextual slash, skip for (int i = 1; i < end; ) { char c = input.charAt(i); if (c == '/') { // common case, got a segment return new JsonPointer(input, input.substring(1, i), _parseTail(input.substring(i))); } ++i; // quoting is different; offline this case if (c == '~' && i < end) { // possibly, quote return _parseQuotedTail(input, i); } // otherwise, loop on } // end of the road, no escapes return new JsonPointer(input, input.substring(1), EMPTY); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
/** * Method called to parse tail of pointer path, when a potentially * escaped character has been seen. * * @param input Full input for the tail being parsed * @param i Offset to character after tilde */ protected static JsonPointer _parseQuotedTail(String input, int i) { final int end = input.length(); StringBuilder sb = new StringBuilder(Math.max(16, end)); if (i > 2) { sb.append(input, 1, i-1); } _appendEscape(sb, input.charAt(i++)); while (i < end) { char c = input.charAt(i); if (c == '/') { // end is nigh! return new JsonPointer(input, sb.toString(), _parseTail(input.substring(i))); } ++i; if (c == '~' && i < end) { _appendEscape(sb, input.charAt(i++)); continue; } sb.append(c); } // end of the road, last segment return new JsonPointer(input, sb.toString(), EMPTY); }
seg = ""; tail = new JsonPointer(_fullPath(tail, seg), seg, tail); } else if (context.inArray() || includeRoot) { int ix = context.getCurrentIndex(); String ixStr = String.valueOf(ix); tail = new JsonPointer(_fullPath(tail, ixStr), ixStr, ix, tail);
seg = ""; tail = new JsonPointer(_fullPath(tail, seg), seg, tail); } else if (context.inArray() || includeRoot) { int ix = context.getCurrentIndex(); String ixStr = String.valueOf(ix); tail = new JsonPointer(_fullPath(tail, ixStr), ixStr, ix, tail);
protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead(int suffixLength, JsonPointer last) { if (this == last) { return EMPTY; } JsonPointer next = _nextSegment; String str = _asString; return new JsonPointer(str.substring(0, str.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected static JsonPointer _parseTail(String input) { final int end = input.length(); // first char is the contextual slash, skip for (int i = 1; i < end; ) { char c = input.charAt(i); if (c == '/') { // common case, got a segment return new JsonPointer(input, input.substring(1, i), _parseTail(input.substring(i))); } ++i; // quoting is different; offline this case if (c == '~' && i < end) { // possibly, quote return _parseQuotedTail(input, i); } // otherwise, loop on } // end of the road, no escapes return new JsonPointer(input, input.substring(1), EMPTY); }
protected static JsonPointer _parseTail(String input) { final int end = input.length(); // first char is the contextual slash, skip for (int i = 1; i < end; ) { char c = input.charAt(i); if (c == '/') { // common case, got a segment return new JsonPointer(input, input.substring(1, i), _parseTail(input.substring(i))); } ++i; // quoting is different; offline this case if (c == '~' && i < end) { // possibly, quote return _parseQuotedTail(input, i); } // otherwise, loop on } // end of the road, no escapes return new JsonPointer(input, input.substring(1), EMPTY); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }
protected JsonPointer _constructHead() { // ok; find out who we are to drop JsonPointer last = last(); if (last == this) { return EMPTY; } // and from that, length of suffix to drop int suffixLength = last._asString.length(); JsonPointer next = _nextSegment; return new JsonPointer(_asString.substring(0, _asString.length() - suffixLength), _matchingPropertyName, _matchingElementIndex, next._constructHead(suffixLength, last)); }