예제 #1
0
  /**
   * {@link WritableSlot}を経由した{@link Writable}の永続化。
   *
   * @throws Exception テストに失敗した場合
   */
  @SuppressWarnings("deprecation")
  @Test
  public void loadStore() throws Exception {
    WritableSlot slot = new WritableSlot();
    IntOption value = new IntOption(100);
    IntOption copy = new IntOption();

    slot.store(value);
    slot.loadTo(copy);
    assertThat(copy, is(value));

    value.modify(200);
    slot.store(value);
    slot.loadTo(copy);
    assertThat(copy, is(value));
  }
예제 #2
0
 @SuppressWarnings("deprecation")
 private void fill0(IntOption option, boolean doRecover) throws CsvFormatException {
   if (lineBuffer.hasRemaining()) {
     try {
       int value = Integer.parseInt(lineBuffer.toString());
       option.modify(value);
     } catch (NumberFormatException e) {
       if (doRecover && trimWhitespaces()) {
         fill0(option, false);
         return;
       }
       throw new CsvFormatException(
           createStatusInLine(Reason.INVALID_CELL_FORMAT, "int value"), e);
     }
   } else {
     option.setNull();
   }
 }