• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValueRange类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.api.services.sheets.v4.model.ValueRange的典型用法代码示例。如果您正苦于以下问题:Java ValueRange类的具体用法?Java ValueRange怎么用?Java ValueRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: testSynchronize_differentValues_updatesValues

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
@Test
public void testSynchronize_differentValues_updatesValues() throws Exception {
  existingSheet.add(createRow("a", "b"));
  existingSheet.add(createRow("diffVal1l", "diffVal2"));
  data = ImmutableList.of(ImmutableMap.of("a", "val1", "b", "val2"));
  sheetSynchronizer.synchronize("aSheetId", data);

  verifyZeroInteractions(appendReq);
  verifyZeroInteractions(clearReq);

  BatchUpdateValuesRequest expectedRequest = new BatchUpdateValuesRequest();
  List<List<Object>> expectedVals = newArrayList();
  expectedVals.add(createRow("val1", "val2"));
  expectedRequest.setData(
      newArrayList(new ValueRange().setRange("Registrars!A2").setValues(expectedVals)));
  expectedRequest.setValueInputOption("RAW");
  verify(values).batchUpdate("aSheetId", expectedRequest);
}
 
开发者ID:google,项目名称:nomulus,代码行数:19,代码来源:SheetSynchronizerTest.java


示例2: postDataToApi

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
/**
 * Posts new Homeworkentry to Spreadsheet Api
 *
 * @throws IOException
 */
private boolean postDataToApi(List<HomeWorkEntry> entries) throws IOException {
    String spreadsheetId = "1XxkZd4iFSV-itiArqJl9ALh_f1ELzTf1nvH97KbOV70";
    //String range = "Class Data!A2:E";
    String range = "homeworkSheet";
    List<List<Object>> values = new ArrayList<>();
    for (HomeWorkEntry entry : entries) {
        values.add(Arrays.asList(entry.getHomeworkEntryDate(), entry.getHomeworkSubject(), entry.getHomework(), entry.getHomeworkDueDate(), entry.getHomeworkComments()));
    }
    ValueRange body = new ValueRange().setValues(values);
    mService
            .spreadsheets().values().append(spreadsheetId, range, body)
            .setValueInputOption("USER_ENTERED")
            .execute();
    return true;
}
 
开发者ID:Pl4gue,项目名称:homeworkManager-android,代码行数:21,代码来源:AddHomeworkPresenter.java


示例3: before

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
@Before
public void before() throws Exception {
  sheetSynchronizer.sheetsService = sheetsService;
  when(sheetsService.spreadsheets()).thenReturn(spreadsheets);
  when(spreadsheets.values()).thenReturn(values);

  when(values.get(any(String.class), any(String.class))).thenReturn(getReq);
  when(values.append(any(String.class), any(String.class), any(ValueRange.class)))
      .thenReturn(appendReq);
  when(values.clear(any(String.class), any(String.class), any(ClearValuesRequest.class)))
      .thenReturn(clearReq);
  when(values.batchUpdate(any(String.class), any(BatchUpdateValuesRequest.class)))
      .thenReturn(updateReq);

  when(appendReq.execute()).thenReturn(new AppendValuesResponse());
  when(appendReq.setValueInputOption(any(String.class))).thenReturn(appendReq);
  when(appendReq.setInsertDataOption(any(String.class))).thenReturn(appendReq);
  when(clearReq.execute()).thenReturn(new ClearValuesResponse());
  when(updateReq.execute()).thenReturn(new BatchUpdateValuesResponse());

  existingSheet = newArrayList();
  data = ImmutableList.of();
  ValueRange valueRange = new ValueRange().setValues(existingSheet);
  when(getReq.execute()).thenReturn(valueRange);
}
 
开发者ID:google,项目名称:nomulus,代码行数:26,代码来源:SheetSynchronizerTest.java


示例4: testSynchronize_unknownFields_doesntUpdate

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
@Test
public void testSynchronize_unknownFields_doesntUpdate() throws Exception {
  existingSheet.add(createRow("a", "c", "b"));
  existingSheet.add(createRow("diffVal1", "sameVal", "diffVal2"));
  data = ImmutableList.of(ImmutableMap.of("a", "val1", "b", "val2", "d", "val3"));
  sheetSynchronizer.synchronize("aSheetId", data);

  verifyZeroInteractions(appendReq);
  verifyZeroInteractions(clearReq);

  BatchUpdateValuesRequest expectedRequest = new BatchUpdateValuesRequest();
  List<List<Object>> expectedVals = newArrayList();
  expectedVals.add(createRow("val1", "sameVal", "val2"));
  expectedRequest.setData(
      newArrayList(new ValueRange().setRange("Registrars!A2").setValues(expectedVals)));
  expectedRequest.setValueInputOption("RAW");
  verify(values).batchUpdate("aSheetId", expectedRequest);
}
 
开发者ID:google,项目名称:nomulus,代码行数:19,代码来源:SheetSynchronizerTest.java


示例5: testSynchronize_notFullRow_getsPadded

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
@Test
public void testSynchronize_notFullRow_getsPadded() throws Exception {
  existingSheet.add(createRow("a", "c", "b"));
  existingSheet.add(createRow("diffVal1", "diffVal2"));
  data = ImmutableList.of(ImmutableMap.of("a", "val1", "b", "paddedVal", "d", "val3"));
  sheetSynchronizer.synchronize("aSheetId", data);

  verifyZeroInteractions(appendReq);
  verifyZeroInteractions(clearReq);

  BatchUpdateValuesRequest expectedRequest = new BatchUpdateValuesRequest();
  List<List<Object>> expectedVals = newArrayList();
  expectedVals.add(createRow("val1", "diffVal2", "paddedVal"));
  expectedRequest.setData(
      newArrayList(new ValueRange().setRange("Registrars!A2").setValues(expectedVals)));
  expectedRequest.setValueInputOption("RAW");
  verify(values).batchUpdate("aSheetId", expectedRequest);
}
 
开发者ID:google,项目名称:nomulus,代码行数:19,代码来源:SheetSynchronizerTest.java


示例6: testSynchronize_moreData_appendsValues

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
@Test
public void testSynchronize_moreData_appendsValues() throws Exception {
  existingSheet.add(createRow("a", "b"));
  existingSheet.add(createRow("diffVal1", "diffVal2"));
  data = ImmutableList.of(
      ImmutableMap.of("a", "val1", "b", "val2"),
      ImmutableMap.of("a", "val3", "b", "val4"));
  sheetSynchronizer.synchronize("aSheetId", data);

  verifyZeroInteractions(clearReq);

  BatchUpdateValuesRequest expectedRequest = new BatchUpdateValuesRequest();
  List<List<Object>> updatedVals = newArrayList();
  updatedVals.add(createRow("val1", "val2"));
  expectedRequest.setData(
      newArrayList(
          new ValueRange().setRange("Registrars!A2").setValues(updatedVals)));
  expectedRequest.setValueInputOption("RAW");
  verify(values).batchUpdate("aSheetId", expectedRequest);

  List<List<Object>> appendedVals = newArrayList();
  appendedVals.add(createRow("val3", "val4"));
  ValueRange appendRequest = new ValueRange().setValues(appendedVals);
  verify(values).append("aSheetId", "Registrars!A3", appendRequest);
}
 
开发者ID:google,项目名称:nomulus,代码行数:26,代码来源:SheetSynchronizerTest.java


示例7: sendToSheets

import com.google.api.services.sheets.v4.model.ValueRange; //导入依赖的package包/类
public void sendToSheets(String sheetId, Map<ClientType, Controller.LoadtestStats> results) {
  List<List<List<Object>>> values = getValuesList(results);
  try {
    service.spreadsheets().values().append(sheetId, "CPS",
        new ValueRange().setValues(values.get(0))).setValueInputOption("USER_ENTERED").execute();
    service.spreadsheets().values().append(sheetId, "Kafka",
        new ValueRange().setValues(values.get(1))).setValueInputOption("USER_ENTERED").execute();
  } catch (IOException e) {
    log.error("Error publishing to spreadsheet " + sheetId + ": " + e);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:pubsub,代码行数:12,代码来源:SheetsService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSLFPictureShape类代码示例发布时间:2022-05-22
下一篇:
Java ORecordDuplicatedException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap