本文整理了Java中com.fasterxml.jackson.core.JsonPointer.last()
方法的一些代码示例,展示了JsonPointer.last()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPointer.last()
方法的具体详情如下:
包路径:com.fasterxml.jackson.core.JsonPointer
类名称:JsonPointer
方法名:last
[英]Returns the leaf of current JSON Pointer expression. Leaf is the last non-null segment of current JSON Pointer.
[中]返回当前JSON指针表达式的叶。叶是当前JSON指针的最后一个非空段。
代码示例来源:origin: redisson/redisson
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));
}
代码示例来源:origin: FasterXML/jackson-core
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));
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
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));
}
代码示例来源:origin: Nextdoor/bender
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));
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
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));
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
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));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
static JsonNode addToObject(final JsonPointer path, final JsonNode node, final JsonNode value) {
final ObjectNode target = (ObjectNode) node.at(path.head());
target.set(path.last().getMatchingProperty(), value);
return node;
}
}
代码示例来源:origin: line/centraldogma
static JsonNode addToObject(final JsonPointer path, final JsonNode node, final JsonNode value) {
final ObjectNode target = (ObjectNode) node.at(path.head());
target.set(path.last().getMatchingProperty(), value);
return node;
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
static JsonNode addToObject(final JsonPointer path, final JsonNode node, final JsonNode value) {
final ObjectNode target = (ObjectNode) node.at(path.head());
target.set(path.last().getMatchingProperty(), value);
return node;
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
@Override
JsonNode apply(final JsonNode node) {
ensureExistence(node);
final JsonNode replacement = valueCopy();
if (path.toString().isEmpty()) {
return replacement;
}
final JsonNode parent = node.at(path.head());
final String rawToken = path.last().getMatchingProperty();
if (parent.isObject()) {
((ObjectNode) parent).set(rawToken, replacement);
} else {
((ArrayNode) parent).set(Integer.parseInt(rawToken), replacement);
}
return node;
}
}
代码示例来源:origin: line/centraldogma
@Override
JsonNode apply(final JsonNode node) {
ensureExistence(node);
final JsonNode replacement = valueCopy();
if (path.toString().isEmpty()) {
return replacement;
}
final JsonNode parent = node.at(path.head());
final String rawToken = path.last().getMatchingProperty();
if (parent.isObject()) {
((ObjectNode) parent).set(rawToken, replacement);
} else {
((ArrayNode) parent).set(Integer.parseInt(rawToken), replacement);
}
return node;
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
@Override
JsonNode apply(final JsonNode node) {
ensureExistence(node);
final JsonNode replacement = valueCopy();
if (path.toString().isEmpty()) {
return replacement;
}
final JsonNode parent = node.at(path.head());
final String rawToken = path.last().getMatchingProperty();
if (parent.isObject()) {
((ObjectNode) parent).set(rawToken, replacement);
} else {
((ArrayNode) parent).set(Integer.parseInt(rawToken), replacement);
}
return node;
}
}
代码示例来源:origin: line/centraldogma
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
ensureExistence(node);
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
ensureExistence(node);
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
ensureExistence(node);
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
final JsonNode found = node.at(path);
if (found.isMissingNode()) {
return node;
}
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else if (parentNode.isArray()) {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
final JsonNode found = node.at(path);
if (found.isMissingNode()) {
return node;
}
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else if (parentNode.isArray()) {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: line/centraldogma
@Override
JsonNode apply(final JsonNode node) {
if (path.toString().isEmpty()) {
return MissingNode.getInstance();
}
final JsonNode found = node.at(path);
if (found.isMissingNode()) {
return node;
}
final JsonNode parentNode = node.at(path.head());
final String raw = path.last().getMatchingProperty();
if (parentNode.isObject()) {
((ObjectNode) parentNode).remove(raw);
} else if (parentNode.isArray()) {
((ArrayNode) parentNode).remove(Integer.parseInt(raw));
}
return node;
}
代码示例来源:origin: line/centraldogma
@Override
JsonNode apply(JsonNode node) {
final JsonNode actual = ensureExistence(node);
if (!EQUIVALENCE.equivalent(actual, oldValue)) {
throw new JsonPatchException("mismatching value at '" + path + "': " +
actual + " (expected: " + oldValue + ')');
}
final JsonNode replacement = newValue.deepCopy();
if (path.toString().isEmpty()) {
return replacement;
}
final JsonNode parent = node.at(path.head());
final String rawToken = path.last().getMatchingProperty();
if (parent.isObject()) {
((ObjectNode) parent).set(rawToken, replacement);
} else {
((ArrayNode) parent).set(Integer.parseInt(rawToken), replacement);
}
return node;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
@Override
JsonNode apply(JsonNode node) {
final JsonNode actual = ensureExistence(node);
if (!EQUIVALENCE.equivalent(actual, oldValue)) {
throw new JsonPatchException("mismatching value at '" + path + "': " +
actual + " (expected: " + oldValue + ')');
}
final JsonNode replacement = newValue.deepCopy();
if (path.toString().isEmpty()) {
return replacement;
}
final JsonNode parent = node.at(path.head());
final String rawToken = path.last().getMatchingProperty();
if (parent.isObject()) {
((ObjectNode) parent).set(rawToken, replacement);
} else {
((ArrayNode) parent).set(Integer.parseInt(rawToken), replacement);
}
return node;
}
内容来源于网络,如有侵权,请联系作者删除!