本文整理汇总了Java中com.redhat.lightblue.client.request.data.DataUpdateRequest.returns方法的典型用法代码示例。如果您正苦于以下问题:Java DataUpdateRequest.returns方法的具体用法?Java DataUpdateRequest.returns怎么用?Java DataUpdateRequest.returns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.redhat.lightblue.client.request.data.DataUpdateRequest
的用法示例。
在下文中一共展示了DataUpdateRequest.returns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWithRange
import com.redhat.lightblue.client.request.data.DataUpdateRequest; //导入方法依赖的package包/类
@Test
public void testWithRange() throws Exception {
Country c1 = new Country();
c1.setName("Poland");
c1.setIso2Code("PL");
c1.setIso3Code("POL");
Country c2 = new Country();
c2.setName("United States");
c2.setIso2Code("US");
c2.setIso3Code("USA");
DataInsertRequest insertRequest = new DataInsertRequest("country");
insertRequest.create(c1, c2);
getLightblueClient().data(insertRequest);
//Do test
DataUpdateRequest updateRequest = new DataUpdateRequest("country");
updateRequest.updates(Update.set("name", "Canada"));
updateRequest.where(Query.withValue("objectType", Query.eq, "country"));
updateRequest.returns(new Projection[]{Projection.includeFieldRecursively("*")}, 0, 1);
Country[] countries = getLightblueClient().data(updateRequest, Country[].class);
assertNotNull(countries);
assertEquals(1, countries.length);
assertEquals("Canada", countries[0].getName());
}
示例2: testProjectionsAsList
import com.redhat.lightblue.client.request.data.DataUpdateRequest; //导入方法依赖的package包/类
@Test
public void testProjectionsAsList() {
DataUpdateRequest request = new DataUpdateRequest("fake");
request.returns(Arrays.asList(Projection.includeField("*")));
assertTrue(request.getBody(), request.getBody().contains(
"\"projection\":{\"field\":\"*\",\"include\":true,\"recursive\":false}"));
}
示例3: testProjectionsAsArray
import com.redhat.lightblue.client.request.data.DataUpdateRequest; //导入方法依赖的package包/类
@Test
public void testProjectionsAsArray() {
DataUpdateRequest request = new DataUpdateRequest("fake");
request.returns(Projection.includeField("*"));
assertTrue(request.getBody(), request.getBody().contains(
"\"projection\":{\"field\":\"*\",\"include\":true,\"recursive\":false}"));
}