本文整理汇总了Java中com.mercateo.common.rest.schemagen.types.ObjectWithSchema.create方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectWithSchema.create方法的具体用法?Java ObjectWithSchema.create怎么用?Java ObjectWithSchema.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mercateo.common.rest.schemagen.types.ObjectWithSchema
的用法示例。
在下文中一共展示了ObjectWithSchema.create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetForId
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的package包/类
@Test
public void testGetForId() throws Exception {
when(factStore.fetchById(TestFacts.one.id())).thenReturn(Optional.of(TestFacts.one));
ObjectWithSchema<FactJson> value = ObjectWithSchema.create(null, JsonHyperSchema.from(Lists
.newArrayList()));
when(schemaCreator.forFactWithId(any())).thenReturn(value);
ObjectWithSchema<FactJson> result = uut.getForId(TestFacts.one.id().toString());
assertThat(result, is(value));
}
示例2: testGetForIdNotFound
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = NotFoundException.class)
public void testGetForIdNotFound() throws Exception {
when(factStore.fetchById(TestFacts.one.id())).thenThrow(IllegalArgumentException.class);
ObjectWithSchema<FactJson> value = ObjectWithSchema.create(null, JsonHyperSchema.from(Lists
.newArrayList()));
when(schemaCreator.forFactWithId(any())).thenReturn(value);
uut.getForId(TestFacts.one.id().toString());
}
示例3: getResponse
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的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);
}
示例4: getSomething
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的package包/类
@Path("/method/{id}")
@GET
@RolesAllowed("test")
@Produces(MediaType.APPLICATION_JSON)
public ObjectWithSchema<Something> getSomething(@PathParam("id") String id) {
Optional<Link> link = linkMetaFactory.createFactoryFor(ResourceClass.class).forCall(Rel.SELF,
r -> r.getSomething(id));
return ObjectWithSchema.create(new Something(), JsonHyperSchema.from(link));
}
示例5: getWithQuery
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的package包/类
@Path("/method/value")
@GET
@Produces(MediaType.APPLICATION_JSON)
public ObjectWithSchema<Void> getWithQuery(@QueryParam("test") String test) {
return ObjectWithSchema.create(null, null);
}
示例6: getSomethingArray
import com.mercateo.common.rest.schemagen.types.ObjectWithSchema; //导入方法依赖的package包/类
@Path("/methods/{id}")
@GET
@RolesAllowed("test")
public ObjectWithSchema<Something[]> getSomethingArray(@PathParam("id") String id) {
Optional<Link> link = linkMetaFactory.createFactoryFor(ResourceClass.class).forCall(Rel.SELF,
r -> r.getSomething(id));
return ObjectWithSchema.create(new Something[0], JsonHyperSchema.from(link));
}