javax.json.spi.JsonProvider.provider()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(147)

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

JsonProvider.provider介绍

[英]Creates a JSON provider object. The provider is loaded using the ServiceLoader#load(Class) method. If there are no available service providers, this method returns the default service provider. Users are recommended to cache the result of this method.
[中]创建JSON提供程序对象。使用ServiceLoader#load(Class)方法加载提供程序。如果没有可用的服务提供程序,此方法将返回默认的服务提供程序。建议用户缓存此方法的结果。

代码示例

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

@Override
  public JsonProvider run() {
   ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
   try {
     Thread.currentThread().setContextClassLoader(JsonLoader.class.getClassLoader());
     return JsonProvider.provider();
   } finally {
     Thread.currentThread().setContextClassLoader(originalLoader);
   }
  }
});

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

/**
 * Creates a JSON generator for writing JSON to a byte stream.
 *
 * @param out i/o stream to which JSON is written
 * @return a JSON generator
 */
public static JsonGenerator createGenerator(OutputStream out) {
  return JsonProvider.provider().createGenerator(out);
}

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

/**
 * Creates a JSON writer to write a
 * JSON {@link JsonObject object} or {@link JsonArray array}
 * structure to the specified character stream.
 *
 * @param writer to which JSON object or array is written
 * @return a JSON writer
 */
public static JsonWriter createWriter(Writer writer) {
  return JsonProvider.provider().createWriter(writer);
}

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

/**
 * Creates a JSON reader from a byte stream. The character encoding of
 * the stream is determined as described in
 * <a href="http://tools.ietf.org/rfc/rfc7159.txt">RFC 7159</a>.
 *
 * @param in a byte stream from which JSON is to be read
 * @return a JSON reader
 */
public static JsonReader createReader(InputStream in) {
  return JsonProvider.provider().createReader(in);
}

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

/**
 * Creates a JSON array builder
 *
 * @return a JSON array builder
 */
public static JsonArrayBuilder createArrayBuilder() {
  return JsonProvider.provider().createArrayBuilder();
}

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

/**
 * Creates a JSON Patch builder (<a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>).
 *
 * @return a JSON Patch builder
 *
 * @since 1.1
 */
public static JsonPatchBuilder createPatchBuilder() {
  return JsonProvider.provider().createPatchBuilder();
}

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

/**
 * Creates a JsonNumber.
 *
 * @param value a JSON number
 * @return the JsonNumber for the number
 *
 * @since 1.1
 */
public static JsonNumber createValue(long value) {
  return JsonProvider.provider().createValue(value);
}

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

/**
 * Creates a JsonNumber.
 *
 * @param value a JSON number
 * @return the JsonNumber for the number
 *
 * @since 1.1
 */
public static JsonNumber createValue(BigDecimal value) {
  return JsonProvider.provider().createValue(value);
}

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

/**
 * Creates a JSON reader from a character stream.
 *
 * @param reader a reader from which JSON is to be read
 * @return a JSON reader
 */
public static JsonReader createReader(Reader reader) {
  return JsonProvider.provider().createReader(reader);
}

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

/**
 * Creates a JSON array builder, initialized with the specified array
 *
 * @param array the initial array in the builder
 * @return a JSON array builder
 *
 * @since 1.1
 */
public static JsonArrayBuilder createArrayBuilder(JsonArray array) {
  return JsonProvider.provider().createArrayBuilder(array);
}

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

/**
 * Creates a JSON object builder
 *
 * @return a JSON object builder
 */
public static JsonObjectBuilder createObjectBuilder() {
  return JsonProvider.provider().createObjectBuilder();
}

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

/**
 * Creates a JsonNumber.
 *
 * @param value a JSON number
 * @return the JsonNumber for the number
 *
 * @since 1.1
 */
public static JsonNumber createValue(double value) {
  return JsonProvider.provider().createValue(value);
}

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

/**
 * Creates a JSON writer to write a
 * JSON {@link JsonObject object} or {@link JsonArray array}
 * structure to the specified byte stream. Characters written to
 * the stream are encoded into bytes using UTF-8 encoding.
 *
 * @param out to which JSON object or array is written
 * @return a JSON writer
 */
public static JsonWriter createWriter(OutputStream out) {
  return JsonProvider.provider().createWriter(out);
}

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

/**
 * Creates a JSON object builder, initialized with the specified object.
 *
 * @param object the initial object in the builder
 * @return a JSON object builder
 *
 * @since 1.1
 */
public static JsonObjectBuilder createObjectBuilder(JsonObject object) {
  return JsonProvider.provider().createObjectBuilder(object);
}

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

/**
 * Creates a JSON parser from a character stream.
 *
 * @param reader i/o reader from which JSON is to be read
 * @return a JSON parser
 */
public static JsonParser createParser(Reader reader) {
  return JsonProvider.provider().createParser(reader);
}

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

/**
 * Creates a JSON generator for writing JSON to a character stream.
 *
 * @param writer a i/o writer to which JSON is written
 * @return a JSON generator
 */
public static JsonGenerator createGenerator(Writer writer) {
  return JsonProvider.provider().createGenerator(writer);
}

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

/**
 * Creates a JSON Patch (<a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>)
 * from the specified operations.
 *
 * @param array patch operations
 * @return a JSON Patch
 *
 * @since 1.1
 */
public static JsonPatch createPatch(JsonArray array) {
  return JsonProvider.provider().createPatch(array);
}

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

/**
 * Creates JSON Merge Patch (<a href="http://tools.ietf.org/html/rfc7396">RFC 7396</a>)
 * from specified {@code JsonValue}.
 *
 * @param patch the patch
 * @return a JSON Merge Patch
 *
 * @since 1.1
 */
public static JsonMergePatch createMergePatch(JsonValue patch) {
  return JsonProvider.provider().createMergePatch(patch);
}

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

/**
 * Creates a JsonString.
 *
 * @param value a JSON string
 * @return the JsonString for the string
 *
 * @since 1.1
 */
public static JsonString createValue(String value) {
  return JsonProvider.provider().createValue(value);
}

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

/**
 * Creates a JsonNumber.
 *
 * @param value a JSON number
 * @return the JsonNumber for the number
 *
 * @since 1.1
 */
public static JsonNumber createValue(int value) {
  return JsonProvider.provider().createValue(value);
}

相关文章