• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Builder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.ws.rs.core.Link.Builder的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Builder类属于javax.ws.rs.core.Link包,在下文中一共展示了Builder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deserialize

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
@Override
public Link deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException, JsonProcessingException {

  final ObjectCodec oc = jsonParser.getCodec();
  final JsonNode node = oc.readTree(jsonParser);

  final JsonNode href = node.get("href");
  if (href == null) {
    return null;
  }

  final Builder linkBuilder = Link.fromUri(href.asText());
  final JsonNode rel = node.get("rel");
  if (rel != null) {
    linkBuilder.rel(rel.asText());
  }
  return linkBuilder.build();
}
 
开发者ID:atgse,项目名称:sam,代码行数:19,代码来源:LinkDeserializer.java


示例2: addHttpMethod

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
private void addHttpMethod(Builder builder, Scope scope) {
    final List<Class<? extends Annotation>> httpMethodAnnotations = Arrays.asList(GET.class,
            POST.class, PUT.class, DELETE.class);
    final Method invokedMethod = scope.getInvokedMethod();
    final Optional<Class<? extends Annotation>> httpMethod = httpMethodAnnotations.stream()
            .filter(invokedMethod::isAnnotationPresent).findFirst();

    if (httpMethod.isPresent()) {
        builder.param(METHOD_PARAM_KEY, httpMethod.get().getSimpleName());
    } else {
        throw new IllegalArgumentException(
                "LinkCreator: The method has to be annotated with one of: " + String.join(", ",
                        (Iterable<String>) httpMethodAnnotations.stream().map(
                                Class::getSimpleName).map(m -> '@' + m)::iterator));
    }
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:17,代码来源:LinkCreator.java


示例3: setRelation

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
public static Builder setRelation(Relation relation, URI uri) {
    requireNonNull(relation);
    requireNonNull(uri);
    Builder builder = Link.fromUri(uri).rel(relation.getName());
    if (requireNonNull(relation).getType().isShouldBeSerialized()) {
        builder.param("relType", relation.getType().getName());
        builder.param("target", relation.getType().getSerializedName());
    }
    return builder;
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:11,代码来源:LinkCreator.java


示例4: createFor

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
/**
 * create a link for a resource method
 *
 * @param scopes
 *            list of Scope objects for every scope level
 * @param relation
 *            relation of method
 * @param linkFactoryContext
 *            the base URI for resolution of relative URIs and method and
 *            property checkers
 * @return link with schema if applicable
 */
public Link createFor(List<Scope> scopes, Relation relation,
        LinkFactoryContext linkFactoryContext) {
    final Class<?> resourceClass = scopes.get(0).getInvokedClass();
    UriBuilder uriBuilder = UriBuilder.fromResource(resourceClass);

    Map<String, Object> pathParameters = new HashMap<>();
    for (Scope scope : scopes) {
        final Method method = scope.getInvokedMethod();
        final Object[] parameters = scope.getParams();
        if (method.isAnnotationPresent(Path.class)) {
            uriBuilder.path(method.getDeclaringClass(), method.getName());
        }
        pathParameters.putAll(collectPathParameters(scope, parameters));
        setQueryParameters(uriBuilder, scope, parameters);
    }

    URI uri = mergeUri(linkFactoryContext.getBaseUri(), uriBuilder, pathParameters);

    Builder builder = setRelation(relation, uri);

    addLinkProperties(scopes, builder);

    detectMediaType(scopes, builder);

    final Scope lastScopedMethod = Iterables.getLast(scopes);
    addHttpMethod(builder, lastScopedMethod);
    addSchemaIfNeeded(builder, lastScopedMethod, linkFactoryContext);
    return builder.build();
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:42,代码来源:LinkCreator.java


示例5: addLinkProperties

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
private void addLinkProperties(List<Scope> scopes, Builder builder) {
    final LinkProperties properties = Iterables.getLast(scopes).getInvokedMethod()
            .getAnnotation(LinkProperties.class);
    if (properties != null) {
        Stream.of(properties.value()).forEach(x -> builder.param(x.key(), x.value()));
    }
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:8,代码来源:LinkCreator.java


示例6: addSchemaIfNeeded

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
private void addSchemaIfNeeded(Builder builder, Scope method,
        LinkFactoryContext linkFactoryContext) {
    Optional<String> optionalInputSchema = jsonSchemaGenerator.createInputSchema(method,
            linkFactoryContext.getFieldCheckerForSchema());
    optionalInputSchema.ifPresent(s -> builder.param(SCHEMA_PARAM_KEY, s));
    Optional<String> mt = detectMediaType(method.getInvokedMethod());
    if (mt.isPresent() && MediaType.APPLICATION_JSON.equals(mt.get())) {
        Optional<String> optionalOutputSchema = jsonSchemaGenerator.createOutputSchema(method,
                linkFactoryContext.getFieldCheckerForSchema());
        optionalOutputSchema.ifPresent(s -> builder.param(TARGET_SCHEMA_PARAM_KEY, s));
    }
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:13,代码来源:LinkCreator.java


示例7: createFor

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
public Link createFor(URI uri, Optional<String> schemaForLink, String relName) {
	Objects.requireNonNull(uri);
	Objects.requireNonNull(schemaForLink);
	Objects.requireNonNull(relName);

	Relation rel = Relation.of(relName, RelType.OTHER);
	Builder linkBuilder = LinkCreator.setRelation(rel, uri);
	schemaForLink.ifPresent(s -> linkBuilder.param(LinkCreator.SCHEMA_PARAM_KEY, s));
	return linkBuilder.build();
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:11,代码来源:ExternalLinkFactory.java


示例8: PaginationHelper

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
public PaginationHelper(
    Supplier<UriBuilder> uriBuilderSupplier, Function<Link.Builder, Link> linkCreator) {

  this.uriBuilderSupplier = uriBuilderSupplier;
  this.linkCreator = linkCreator;
}
 
开发者ID:Nexmo,项目名称:comms-router,代码行数:7,代码来源:PaginationHelper.java


示例9: createLinkBuilder

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
@Override
public Builder createLinkBuilder() {
    throw new UnsupportedOperationException();
}
 
开发者ID:minijax,项目名称:minijax,代码行数:5,代码来源:MinijaxRuntimeDelegate.java


示例10: getLinkBuilder

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
@Override
public Builder getLinkBuilder(final String relation)
{
    return delegate.getLinkBuilder(relation);
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:6,代码来源:ResponseWrapper.java


示例11: getLinkBuilder

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
@Override
public Builder getLinkBuilder(String relation) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:6,代码来源:PresentationsResource.java


示例12: getLinkBuilder

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
@Override
public Builder getLinkBuilder(String relation) {
  // TODO Auto-generated method stub
  return null;
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:6,代码来源:ResponseImpl.java


示例13: detectMediaType

import javax.ws.rs.core.Link.Builder; //导入依赖的package包/类
private void detectMediaType(Collection<Scope> scopes, Builder builder) {
    detectMediaType(Iterables.getLast(scopes).getInvokedMethod()).ifPresent(mediatype -> builder
            .param("mediaType", mediatype));
}
 
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:5,代码来源:LinkCreator.java



注:本文中的javax.ws.rs.core.Link.Builder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CanonicalizerPhysical类代码示例发布时间:2022-05-22
下一篇:
Java DcMotorController类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap