本文整理汇总了Java中com.mercateo.common.rest.schemagen.link.LinkFactory类的典型用法代码示例。如果您正苦于以下问题:Java LinkFactory类的具体用法?Java LinkFactory怎么用?Java LinkFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkFactory类属于com.mercateo.common.rest.schemagen.link包,在下文中一共展示了LinkFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FactsObserver
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
public FactsObserver(@NonNull EventOutput eventOutput,
@NonNull LinkFactory<FactsResource> linkFatory,
@NonNull HyperSchemaCreator hyperSchemaCreator, @NonNull URI baseURI,
@NonNull AtomicReference<Subscription> subcription,
@NonNull FactTransformer factTransformer, boolean fullOutputMode) {
super();
this.fullOutputMode = fullOutputMode;
this.eventOutput = eventOutput;
this.linkFatory = linkFatory;
this.hyperSchemaCreator = hyperSchemaCreator;
this.subcription = subcription;
this.factTransformer = factTransformer;
// this is need, because we are nor in requestscope anymore
this.linkFactoryContext = new LinkFactoryContext() {
@Override
public MethodCheckerForLink getMethodCheckerForLink() {
return m -> true;
}
@Override
public FieldCheckerForSchema getFieldCheckerForSchema() {
return (f, c) -> true;
}
@Override
public URI getBaseUri() {
return baseURI;
}
};
}
示例2: FactsObserverFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@VisibleForTesting
FactsObserverFactory(@NonNull LinkFactory<FactsResource> factsResourceLinkFactory,
@NonNull HyperSchemaCreator hyperSchemaCreator,
@NonNull FactTransformer factTransformer,
@NonNull ScheduledExecutorService executorService, int waitSecondsForCleanUpCheck) {
this.factsResourceLinkFactory = factsResourceLinkFactory;
this.hyperSchemaCreator = hyperSchemaCreator;
this.factTransformer = factTransformer;
this.executorService = executorService;
this.waitSecondsForCleanUpCheck = waitSecondsForCleanUpCheck;
}
示例3: getListing
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@SuppressWarnings("boxing")
@GET
@Produces(MediaType.APPLICATION_JSON)
public PaginatedResponse<SummaryJsonType> getListing(@BeanParam @NotNull @Valid SearchQueryBean searchQueryBean) {
final ListingResult<SummaryJsonType> summaries = getSummaryListing(searchQueryBean);
final LinkFactory<ImplementationType> lf = getImplementationLinkFactory();
final List<ObjectWithSchema<SummaryJsonType>> listForResponse = summaries.getResultList().stream()
.map(r -> getResponse(r, lf)).collect(Collectors.toList());
List<Link> links = Lists.newArrayList();
lf.forCall(REL_INSTANCE, r -> r.get(IdParameterBean.of(null))).ifPresent(links::add);
int offset = searchQueryBean.getOffset();
int limit = searchQueryBean.getLimit();
PaginationLinkBuilder paginationLinkBuilder = PaginationLinkBuilder.of(summaries.getTotalNumberOfHits(),
searchQueryBean.getOffset(), searchQueryBean.getLimit());
links.addAll(paginationLinkBuilder.generateLinks((rel, off, lim) -> {
searchQueryBean.setLimit(lim);
searchQueryBean.setOffset(off);
return lf.forCall(rel, r -> r.getListing(searchQueryBean));
}));
links.addAll(createAdditionalLinksForListing(searchQueryBean));
return PaginatedResponse.create(listForResponse, summaries.getTotalNumberOfHits(), offset, limit,
JsonHyperSchema.from(links));
}
示例4: createSchemaForSummary
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
private List<Optional<Link>> createSchemaForSummary(SummaryJsonType summaryJson,
LinkFactory<ImplementationType> factoryForImplementation) {
final Optional<Link> selfLink = factoryForImplementation.forCall(Rel.SELF,
r -> r.getSummary(IdParameterBean.of(summaryJson.getId())));
final Optional<Link> canonicalLink = factoryForImplementation.forCall(Rel.CANONICAL,
r -> r.get(IdParameterBean.of(summaryJson.getId())));
final ArrayList<Optional<Link>> result = Lists.newArrayList(selfLink, canonicalLink);
final List<Optional<Link>> additionalLinks = createAdditionalLinksForSummaryType(summaryJson,
factoryForImplementation);
result.addAll(additionalLinks);
return result;
}
示例5: getResponse
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
protected ObjectWithSchema<FullJsonType> getResponse(FullJsonType json) {
final LinkFactory<ImplementationType> factoryForImplementation = getImplementationLinkFactory();
final Optional<Link> selfLink = factoryForImplementation.forCall(Rel.SELF,
r -> r.get(IdParameterBean.of(json.getId())));
final ArrayList<Optional<Link>> result = Lists.newArrayList(selfLink);
final List<Optional<Link>> additionalLinks = createAdditionalLinksForFullType(json, factoryForImplementation);
result.addAll(additionalLinks);
final JsonHyperSchema hyperSchema = JsonHyperSchema.fromOptional(result);
return ObjectWithSchema.create(json, hyperSchema);
}
示例6: rootResourceLinkFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@Bean
LinkFactory<RootResource> rootResourceLinkFactory(LinkMetaFactory linkMetaFactory) {
return linkMetaFactory.createFactoryFor(RootResource.class);
}
示例7: transactionsResourceLinkFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@Bean
LinkFactory<FactsTransactionsResource> transactionsResourceLinkFactory(
LinkMetaFactory linkMetaFactory) {
return linkMetaFactory.createFactoryFor(FactsTransactionsResource.class);
}
示例8: factsResourceLinkFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@Bean
LinkFactory<FactsResource> factsResourceLinkFactory(LinkMetaFactory linkMetaFactory) {
return linkMetaFactory.createFactoryFor(FactsResource.class);
}
示例9: getImplementationLinkFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
protected LinkFactory<ImplementationType> getImplementationLinkFactory() {
return linkMetaFactory.createFactoryFor(implementationClass);
}
示例10: createAdditionalLinksForSummaryType
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
protected List<Optional<Link>> createAdditionalLinksForSummaryType(SummaryJsonType summaryJson,
LinkFactory<ImplementationType> factoryForImplementation) {
return new ArrayList<>();
}
示例11: createAdditionalLinksForFullType
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
protected List<Optional<Link>> createAdditionalLinksForFullType(FullJsonType json,
LinkFactory<ImplementationType> factoryForImplementation) {
return new ArrayList<Optional<Link>>();
}
示例12: getHello
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@GET
public String getHello() {
final LinkFactory<HelloResource> linkFactory = linkMetaFactory.createFactoryFor(HelloResource.class);
linkFactory.forCall(Rel.SELF, HelloResource::getHello);
return "Hello World!";
}
示例13: createLinkFactory
import com.mercateo.common.rest.schemagen.link.LinkFactory; //导入依赖的package包/类
@Benchmark
public static void createLinkFactory() {
final LinkFactory<ResourceClass> linkFactory = linkMetaFactory.createFactoryFor(ResourceClass.class);
}