当前位置: 首页>>代码示例>>Java>>正文


Java ResourceAssembler类代码示例

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


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

示例1: list

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
/**
 * List Counters that match the given criteria.
 */
@RequestMapping(value = "", method = RequestMethod.GET)
public PagedResources<? extends MetricResource> list(
		Pageable pageable,
		PagedResourcesAssembler<Metric<Double>> pagedAssembler,
		@RequestParam(value = "detailed", defaultValue = "false") boolean detailed) {
	/* Page */ Iterable<Metric<?>> metrics = metricRepository.findAll(/* pageable */);
	List<Metric<Double>> content = filterCounters(metrics);
	long count = content.size();
	long pageEnd = Math.min(count, pageable.getOffset() + pageable.getPageSize());
	Page counterPage = new PageImpl<>(content.subList(pageable.getOffset(), (int) pageEnd), pageable, content.size());
	ResourceAssembler<Metric<Double>, ? extends MetricResource> assemblerToUse =
			detailed ? counterResourceAssembler : shallowResourceAssembler;
	return pagedAssembler.toResource(counterPage, assemblerToUse);
}
 
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:18,代码来源:CounterController.java

示例2: submissionStatusResourceAssembler

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
@Bean
public ResourceAssembler<StatusDescription, Resource<StatusDescription>> submissionStatusResourceAssembler() {
    return entity -> {
        Resource<StatusDescription> res = new Resource<StatusDescription>(entity);

        res.add(
                linkTo(
                        methodOn(StatusDescriptionController.class).submissionStatus(entity.getStatusName()
                        )
                ).withSelfRel()
        );

        return res;
    };
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:16,代码来源:StatusResourceAssemblerConfig.java

示例3: processingStatusResourceAssembler

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
@Bean
public ResourceAssembler<StatusDescription, Resource<StatusDescription>> processingStatusResourceAssembler() {
    return entity -> {
        Resource<StatusDescription> res = new Resource<StatusDescription>(entity);

        res.add(
                linkTo(
                        methodOn(StatusDescriptionController.class).processingStatus(entity.getStatusName())
                ).withSelfRel()
        );

        return res;
    };
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:15,代码来源:StatusResourceAssemblerConfig.java

示例4: releaseStatusResourceAssembler

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
@Bean
public ResourceAssembler<StatusDescription, Resource<StatusDescription>> releaseStatusResourceAssembler() {
    return entity -> {
        Resource<StatusDescription> res = new Resource<StatusDescription>(entity);

        res.add(
                linkTo(
                        methodOn(StatusDescriptionController.class).releaseStatus(entity.getStatusName())
                ).withSelfRel()
        );

        return res;
    };
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:15,代码来源:StatusResourceAssemblerConfig.java

示例5: SubmissionStatusController

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
public SubmissionStatusController(Map<String, StatusDescription> submissionStatusDescriptionMap, SubmissionRepository submissionRepository, ValidationResultService validationResultService, ResourceAssembler<StatusDescription, Resource<StatusDescription>> submissionStatusResourceAssembler, RepositoryEntityLinks repositoryEntityLinks) {
    this.submissionStatusDescriptionMap = submissionStatusDescriptionMap;
    this.submissionRepository = submissionRepository;
    this.validationResultService = validationResultService;
    this.submissionStatusResourceAssembler = submissionStatusResourceAssembler;
    this.repositoryEntityLinks = repositoryEntityLinks;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:8,代码来源:SubmissionStatusController.java

示例6: StatusDescriptionController

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
public StatusDescriptionController(List<StatusDescription> releaseStatuses, List<StatusDescription> processingStatuses, List<StatusDescription> submissionStatuses, PagedResourcesAssembler pagedResourcesAssembler, ResourceAssembler<StatusDescription, Resource<StatusDescription>> processingStatusResourceAssembler, ResourceAssembler<StatusDescription, Resource<StatusDescription>> releaseStatusResourceAssembler, ResourceAssembler<StatusDescription, Resource<StatusDescription>> submissionStatusResourceAssembler) {
    this.releaseStatuses = releaseStatuses;
    this.processingStatuses = processingStatuses;
    this.submissionStatuses = submissionStatuses;
    this.pagedResourcesAssembler = pagedResourcesAssembler;
    this.processingStatusResourceAssembler = processingStatusResourceAssembler;
    this.releaseStatusResourceAssembler = releaseStatusResourceAssembler;
    this.submissionStatusResourceAssembler = submissionStatusResourceAssembler;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:10,代码来源:StatusDescriptionController.java

示例7: GameController

import org.springframework.hateoas.ResourceAssembler; //导入依赖的package包/类
@Autowired
GameController(GameService gameService, ResourceAssembler<Game, Resource<Game>> resourceAssembler) {
    this.gameService = gameService;
    this.resourceAssembler = resourceAssembler;
}
 
开发者ID:nebhale,项目名称:devoxx-2013,代码行数:6,代码来源:GameController.java


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