org.glassfish.jersey.internal.util.collection.Ref类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(191)

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

Ref介绍

[英]A possibly mutable value reference. Reference can be initialized by #set(Object)and the reference can be get by #get().
[中]一个可能可变的值引用。引用可以通过#set(Object)初始化,引用可以通过#get()获取。

代码示例

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

  1. @Override
  2. public void onStatistics(MonitoringStatistics statistics) {
  3. statisticsFactory.get().set(statistics);
  4. }
  5. }

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

  1. @Override
  2. public T get() {
  3. return referenceFactory.get().get();
  4. }

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

  1. /**
  2. * Lazily initialize {@link AsyncContext} for this
  3. * request processing context.
  4. * <p>
  5. * The {@code lazyContextValue} will be only invoked once during the first call to {@link #asyncContext()}.
  6. * As such, the asynchronous context for this request can be initialized lazily, on demand.
  7. * </p>
  8. *
  9. * @param lazyContextValue lazily initialized {@code AsyncContext} instance bound to this request processing context.
  10. */
  11. // TODO figure out how to make this package-private.
  12. public void initAsyncContext(Value<AsyncContext> lazyContextValue) {
  13. asyncContextValueRef.set(Values.lazy(lazyContextValue));
  14. }

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

  1. /**
  2. * Get a {@link Value} instance holding the asynchronous context associated with this request processing context.
  3. *
  4. * May return an empty value if no asynchronous context has been initialized in this request processing context yet.
  5. *
  6. * @return value instance holding the asynchronous context associated with this request processing context.
  7. * The returned value may be empty, if no asynchronous context has been initialized yet
  8. * (see {@link #initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)}).
  9. */
  10. public Value<AsyncContext> asyncContextValue() {
  11. return asyncContextValueRef.get();
  12. }

代码示例来源:origin: com.baidu.hugegraph/hugegraph-common

  1. public RestResult delete(String path, Map<String, Object> params) {
  2. Ref<WebTarget> target = Refs.of(this.target);
  3. for (String key : params.keySet()) {
  4. target.set(target.get().queryParam(key, params.get(key)));
  5. }
  6. Response response = this.request(() -> {
  7. return target.get().path(path).request().delete();
  8. });
  9. checkStatus(response, Response.Status.NO_CONTENT,
  10. Response.Status.ACCEPTED);
  11. return new RestResult(response);
  12. }

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

  1. /**
  2. * Lazily initialize {@link AsyncContext} for this
  3. * request processing context.
  4. * <p>
  5. * The {@code lazyContextValue} will be only invoked once during the first call to {@link #asyncContext()}.
  6. * As such, the asynchronous context for this request can be initialized lazily, on demand.
  7. * </p>
  8. *
  9. * @param lazyContextValue lazily initialized {@code AsyncContext} instance bound to this request processing context.
  10. */
  11. // TODO figure out how to make this package-private.
  12. public void initAsyncContext(Value<AsyncContext> lazyContextValue) {
  13. asyncContextValueRef.set(Values.lazy(lazyContextValue));
  14. }

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

  1. /**
  2. * Get a {@link Value} instance holding the asynchronous context associated with this request processing context.
  3. *
  4. * May return an empty value if no asynchronous context has been initialized in this request processing context yet.
  5. *
  6. * @return value instance holding the asynchronous context associated with this request processing context.
  7. * The returned value may be empty, if no asynchronous context has been initialized yet
  8. * (see {@link #initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)}).
  9. */
  10. public Value<AsyncContext> asyncContextValue() {
  11. return asyncContextValueRef.get();
  12. }

代码示例来源:origin: com.baidu.hugegraph/hugegraph-common

  1. public RestResult put(String path, String id, Object object,
  2. Map<String, Object> params) {
  3. Ref<WebTarget> target = Refs.of(this.target);
  4. if (params != null && !params.isEmpty()) {
  5. for (String key : params.keySet()) {
  6. target.set(target.get().queryParam(key, params.get(key)));
  7. }
  8. }
  9. Response response = this.request(() -> {
  10. return target.get().path(path).path(encode(id)).request()
  11. .put(Entity.json(object));
  12. });
  13. // If check status failed, throw client exception.
  14. checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED);
  15. return new RestResult(response);
  16. }

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

  1. @Override
  2. public void onStatistics(MonitoringStatistics statistics) {
  3. statisticsFactory.get().set(statistics);
  4. }
  5. }

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

  1. @Override
  2. public T provide() {
  3. return referenceFactory.get().get();
  4. }

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

  1. varyHeaderValue.set(varyValue);

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

  1. @Override
  2. public boolean equals(final Object obj) {
  3. if (obj == null) {
  4. return false;
  5. }
  6. if (!(obj instanceof Ref)) {
  7. return false;
  8. }
  9. Object otherRef = ((Ref) obj).get();
  10. T localRef = this.reference;
  11. return localRef == otherRef || (localRef != null && localRef.equals(otherRef));
  12. }

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

  1. @Override
  2. public ClientRequest apply(ClientRequest requestContext) {
  3. requestRefProvider.get().set(requestContext);
  4. requestContext.setWorkers(workersProvider);
  5. requestContext.setWriterInterceptors(writerInterceptors);
  6. requestContext.setReaderInterceptors(readerInterceptors);
  7. return requestContext;
  8. }
  9. }

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

  1. @Override
  2. public T provide() {
  3. return referenceFactory.get().get();
  4. }

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

  1. varyHeaderValue.set(varyValue);

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

  1. @Override
  2. public boolean equals(final Object obj) {
  3. if (obj == null) {
  4. return false;
  5. }
  6. if (!(obj instanceof Ref)) {
  7. return false;
  8. }
  9. Object otherRef = ((Ref) obj).get();
  10. return this.reference == otherRef || (this.reference != null && this.reference.equals(otherRef));
  11. }

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

  1. private void processApplicationStatistics(ApplicationEvent event) {
  2. final long now = System.currentTimeMillis();
  3. final ApplicationInfo applicationInfo = new ApplicationInfoImpl(event.getResourceConfig(),
  4. new Date(now), event.getRegisteredClasses(),
  5. event.getRegisteredInstances(), event.getProviders());
  6. applicationInfoRefProvider.get().set(applicationInfo);
  7. }

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

  1. @Override
  2. public T get() {
  3. return referenceFactory.get().get();
  4. }

代码示例来源:origin: oracle/helidon

  1. injectionManager.<Ref<ServerRequest>>getInstance(requestType).set(req);
  2. injectionManager.<Ref<ServerResponse>>getInstance(responseType).set(res);
  3. injectionManager.<Ref<Span>>getInstance(spanType).set(req.span());
  4. injectionManager.<Ref<SpanContext>>getInstance(spanContextType).set(req.spanContext());
  5. });

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

  1. @Override
  2. public boolean equals(final Object obj) {
  3. if (obj == null) {
  4. return false;
  5. }
  6. if (!(obj instanceof Ref)) {
  7. return false;
  8. }
  9. Object otherRef = ((Ref) obj).get();
  10. return this.reference == otherRef || (this.reference != null && this.reference.equals(otherRef));
  11. }

相关文章

Ref类方法