本文整理了Java中com.fasterxml.jackson.core.JsonPointer.valueOf()
方法的一些代码示例,展示了JsonPointer.valueOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPointer.valueOf()
方法的具体详情如下:
包路径:com.fasterxml.jackson.core.JsonPointer
类名称:JsonPointer
方法名:valueOf
[英]Alias for #compile; added to make instances automatically deserializable by Jackson databind.
[中]#compile的别名;添加以使实例可由Jackson数据绑定自动反序列化。
代码示例来源:origin: palantir/atlasdb
private static JsonNode findRoot(JsonNode node, @Nullable String configRoot) {
if (Strings.isNullOrEmpty(configRoot)) {
return node;
}
JsonNode root = node.at(JsonPointer.valueOf(configRoot));
if (root.isMissingNode()) {
return null;
}
return root;
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
private static void computeUnchangedArray(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final int size = Math.min(source.size(), target.size());
for (int i = 0; i < size; i++) {
computeUnchanged(ret, pointer.append(JsonPointer.valueOf("/" + i)),
source.get(i), target.get(i));
}
}
代码示例来源:origin: DigitalPebble/storm-crawler
public void configure(@SuppressWarnings("rawtypes") Map stormConf,
JsonNode filterParams) {
java.util.Iterator<Entry<String, JsonNode>> iter = filterParams
.fields();
while (iter.hasNext()) {
Entry<String, JsonNode> entry = iter.next();
String key = entry.getKey();
JsonNode node = entry.getValue();
LabelledJsonPointer labelP = new LabelledJsonPointer(key,
JsonPointer.valueOf(node.asText()));
expressions.add(labelP);
}
}
代码示例来源:origin: line/centraldogma
private static void computeUnchangedArray(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final int size = Math.min(source.size(), target.size());
for (int i = 0; i < size; i++) {
computeUnchanged(ret, pointer.append(JsonPointer.valueOf("/" + i)),
source.get(i), target.get(i));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
private static void computeUnchangedObject(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final Iterator<String> sourceFields = source.fieldNames();
while (sourceFields.hasNext()) {
final String name = sourceFields.next();
if (!target.has(name)) {
continue;
}
computeUnchanged(ret, pointer.append(JsonPointer.valueOf('/' + name)),
source.get(name), target.get(name));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
private static void computeUnchangedArray(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final int size = Math.min(source.size(), target.size());
for (int i = 0; i < size; i++) {
computeUnchanged(ret, pointer.append(JsonPointer.valueOf("/" + i)),
source.get(i), target.get(i));
}
}
代码示例来源:origin: com.palantir.atlasdb/atlasdb-config
private static JsonNode findRoot(JsonNode node, @Nullable String configRoot) {
if (Strings.isNullOrEmpty(configRoot)) {
return node;
}
JsonNode root = node.at(JsonPointer.valueOf(configRoot));
if (root.isMissingNode()) {
return null;
}
return root;
}
代码示例来源:origin: line/centraldogma
private static void computeUnchangedObject(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final Iterator<String> sourceFields = source.fieldNames();
while (sourceFields.hasNext()) {
final String name = sourceFields.next();
if (!target.has(name)) {
continue;
}
computeUnchanged(ret, pointer.append(JsonPointer.valueOf(encodeSegment(name))),
source.get(name), target.get(name));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
private static void computeUnchangedObject(final Map<JsonPointer, JsonNode> ret, final JsonPointer pointer,
final JsonNode source, final JsonNode target) {
final Iterator<String> sourceFields = source.fieldNames();
while (sourceFields.hasNext()) {
final String name = sourceFields.next();
if (!target.has(name)) {
continue;
}
computeUnchanged(ret, pointer.append(JsonPointer.valueOf(encodeSegment(name))),
source.get(name), target.get(name));
}
}
代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor
public AbstractNode find(String pointer) {
if (StringUtils.emptyToNull(pointer) == null) {
return null;
}
if (pointer.startsWith("#")) {
pointer = pointer.substring(1);
}
if (pointer.length() > 1 && pointer.endsWith("/")) {
pointer = pointer.substring(0, pointer.length() - 1);
}
try {
pointer = URLDecoder.decode(pointer, "UTF-8");
} catch (UnsupportedEncodingException e) {
// leave the pointer as it is
}
try {
return nodes.get(JsonPointer.valueOf(pointer));
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
private static void generateObjectDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ObjectNode source, final ObjectNode target) {
final Set<String> sourceFields = new TreeSet<>();
Iterators.addAll(sourceFields, source.fieldNames());
final Set<String> targetFields = new TreeSet<>();
Iterators.addAll(targetFields, target.fieldNames());
for (final String field : Sets.difference(sourceFields, targetFields)) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf('/' + field)));
}
for (final String field : Sets.difference(targetFields, sourceFields)) {
processor.valueAdded(pointer.append(JsonPointer.valueOf('/' + field)), target.get(field));
}
for (final String field : Sets.intersection(sourceFields, targetFields)) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf('/' + field)),
source.get(field), target.get(field));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-shaded
private static void generateArrayDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ArrayNode source, final ArrayNode target) {
final int sourceSize = source.size();
final int targetSize = target.size();
final int size = Math.min(sourceSize, targetSize);
/*
* Source array is larger; in this case, elements are removed from the
* target; the index of removal is always the original arrays's length.
*/
for (int index = size; index < sourceSize; index++) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf("/" + size)));
}
for (int index = 0; index < size; index++) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf("/" + index)),
source.get(index), target.get(index));
}
// Deal with the destination array being larger...
for (int index = size; index < targetSize; index++) {
processor.valueAdded(pointer.append(END_OF_ARRAY_POINTER), target.get(index));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
private static void generateArrayDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ArrayNode source, final ArrayNode target) {
final int sourceSize = source.size();
final int targetSize = target.size();
final int size = Math.min(sourceSize, targetSize);
/*
* Source array is larger; in this case, elements are removed from the
* target; the index of removal is always the original arrays's length.
*/
for (int index = size; index < sourceSize; index++) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf("/" + size)));
}
for (int index = 0; index < size; index++) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf("/" + index)),
source.get(index), target.get(index));
}
// Deal with the destination array being larger...
for (int index = size; index < targetSize; index++) {
processor.valueAdded(pointer.append(END_OF_ARRAY_POINTER), target.get(index));
}
}
代码示例来源:origin: line/centraldogma
private static void generateObjectDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ObjectNode source, final ObjectNode target) {
final Set<String> sourceFields = new TreeSet<>();
Iterators.addAll(sourceFields, source.fieldNames());
final Set<String> targetFields = new TreeSet<>();
Iterators.addAll(targetFields, target.fieldNames());
for (final String field : Sets.difference(sourceFields, targetFields)) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf(encodeSegment(field))));
}
for (final String field : Sets.difference(targetFields, sourceFields)) {
processor.valueAdded(pointer.append(JsonPointer.valueOf(encodeSegment(field))), target.get(field));
}
for (final String field : Sets.intersection(sourceFields, targetFields)) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf(encodeSegment(field))),
source.get(field), target.get(field));
}
}
代码示例来源:origin: line/centraldogma
private static void generateArrayDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ArrayNode source, final ArrayNode target) {
final int sourceSize = source.size();
final int targetSize = target.size();
final int size = Math.min(sourceSize, targetSize);
/*
* Source array is larger; in this case, elements are removed from the
* target; the index of removal is always the original arrays's length.
*/
for (int index = size; index < sourceSize; index++) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf("/" + size)));
}
for (int index = 0; index < size; index++) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf("/" + index)),
source.get(index), target.get(index));
}
// Deal with the destination array being larger...
for (int index = size; index < targetSize; index++) {
processor.valueAdded(pointer.append(END_OF_ARRAY_POINTER), target.get(index));
}
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common
private static void generateObjectDiffs(final DiffProcessor processor, final JsonPointer pointer,
final ObjectNode source, final ObjectNode target) {
final Set<String> sourceFields = new TreeSet<>();
Iterators.addAll(sourceFields, source.fieldNames());
final Set<String> targetFields = new TreeSet<>();
Iterators.addAll(targetFields, target.fieldNames());
for (final String field : Sets.difference(sourceFields, targetFields)) {
processor.valueRemoved(pointer.append(JsonPointer.valueOf(encodeSegment(field))));
}
for (final String field : Sets.difference(targetFields, sourceFields)) {
processor.valueAdded(pointer.append(JsonPointer.valueOf(encodeSegment(field))), target.get(field));
}
for (final String field : Sets.intersection(sourceFields, targetFields)) {
generateDiffs(processor, pointer.append(JsonPointer.valueOf(encodeSegment(field))),
source.get(field), target.get(field));
}
}
内容来源于网络,如有侵权,请联系作者删除!