Пример #1
0
 private void checkValue(Storeable value) throws ColumnFormatException {
   if (value == null) {
     throw new IllegalArgumentException("Value is null");
   }
   try {
     for (int i = 0; i < columnTypes.size(); ++i) {
       if (value.getColumnAt(i) != null
           && !columnTypes.get(i).equals(value.getColumnAt(i).getClass())) {
         throw new ColumnFormatException(
             "Wrong column type. was: "
                 + value.getColumnAt(i).getClass().toString()
                 + "; expected: "
                 + columnTypes.get(i));
       }
     }
     boolean unusedValue = true;
     try {
       value.getColumnAt(columnTypes.size());
     } catch (IndexOutOfBoundsException e) {
       unusedValue = false;
     }
     if (unusedValue) {
       throw new ColumnFormatException("Alien value");
     }
   } catch (IndexOutOfBoundsException e) {
     throw new ColumnFormatException("Alien value", e);
   }
 }