本文整理匯總了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}"));
}