javax.json.JsonPointer类的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中javax.json.JsonPointer类的一些代码示例,展示了JsonPointer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPointer类的具体详情如下:
包路径:javax.json.JsonPointer
类名称:JsonPointer

JsonPointer介绍

[英]This class is an immutable representation of a JSON Pointer as specified in RFC 6901.

JSON Pointer is a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document [RFC4627]. JSON Pointer is intended to be easily expressed in JSON string values as well as Uniform Resource Identifier (URI) [RFC3986] fragment identifiers.

The method #getValue returns the referenced value. The methods #add, #replace, and #remove executes the operations specified in RFC 6902.
[中]此类是RFC 6901中指定的JSON指针的不可变表示形式。
JSON指针是一种字符串语法,用于标识JavaScript对象表示法(JSON)文档[RFC4627]中的特定值。JSON指针旨在以JSON字符串值以及统一资源标识符(URI)[RFC3986]片段标识符轻松表示。
方法#getValue返回引用值。方法#add、#replace和#remove执行RFC 6902中指定的操作。

代码示例

代码示例来源:origin: wildfly/wildfly

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: wildfly/wildfly

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.talend.sdk.component/component-runtime-manager

private Object extractValue(final JsonObject payload) {
  if (!pointer.containsValue(payload)) {
    return null;
  }
  return ofNullable(pointer.getValue(payload)).map(this::mapValue).orElse(null);
}

代码示例来源:origin: javax/javaee-web-api

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.glassfish/javax.json

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: javax.json/javax.json-api

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.glassfish/jakarta.json

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: jboss/jboss-javaee-specs

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: jakarta.json/jakarta.json-api

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: eclipse-ee4j/jsonp

switch (Operation.fromOperationName(operation.getString("op"))) {
  case ADD:
    return pointer.add(target, getValue(operation));
  case REPLACE:
    return pointer.replace(target, getValue(operation));
  case REMOVE:
    return pointer.remove(target);
  case COPY:
    from = getPointer(operation, "from");
    return pointer.add(target, from.getValue(target));
  case MOVE:
    if (!from.containsValue(target)) {
      throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
    return pointer.add(from.remove(target), from.getValue(target));
  case TEST:
    if (! getValue(operation).equals(pointer.getValue(target))) {
      throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));

代码示例来源:origin: javaee/jsonp

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: eclipse-ee4j/jsonp

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: eclipse-ee4j/jsonp

/**
   * Get the value referenced by the provided JSON Pointer in the JsonStructure.
   *
   * @param jsonPointer the JSON Pointer
   * @return the {@code JsonValue} at the referenced location
   * @throws JsonException if the JSON Pointer is malformed, or if it references
   *     a non-existing member or value.
   *
   * @since 1.1
   */
  default public JsonValue getValue(String jsonPointer) {
    return Json.createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: org.talend.sdk.component/component-server-proxy

public Optional<String> findEnclosedFormId(final String type, final String lang, final JsonObject payload) {
  return doEnrich(type, lang,
      patch -> ofNullable(patch.getTypePointer())
          .map(it -> it.getValue(payload))
          .filter(it -> it.getValueType() == STRING)
          .map(it -> JsonString.class.cast(it).getString())
          .orElseThrow(() -> new IllegalArgumentException(
              "No form identifier available, check your server configuration.")));
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-json_1.1_spec

default JsonValue getValue(String jsonPointer) {
    return JsonProvider.provider().createPointer(jsonPointer).getValue(this);
  }
}

代码示例来源:origin: apache/meecrowave

default JsonValue getValue(String jsonPointer) {
    return JsonProvider.provider().createPointer(jsonPointer).getValue(this);
  }
}

相关文章