.equals(KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType())))
private void checkColumn(Type... passedTypes) { for (Type type : passedTypes) { if (this.column.getType().equals(type)) { return; } } throw new IllegalArgumentException(String.format("%s's type isn't %s, it's %s", column.getName(), Arrays.toString(passedTypes), column.getType().getName())); } }
/** * Checks that the column is one of the expected types. * @param column the column being checked * @param passedTypes the expected types (logical OR) */ private static void checkColumn(ColumnSchema column, Type... passedTypes) { for (Type type : passedTypes) { if (column.getType().equals(type)) { return; } } throw new IllegalArgumentException(String.format("%s's type isn't %s, it's %s", column.getName(), Arrays.toString(passedTypes), column.getType().getName())); }
/** * Verifies if the column exists and belongs to one of the specified types * @param column column the user wants to set * @param types types we expect * @throws IllegalArgumentException if the column or type was invalid */ private void checkColumn(ColumnSchema column, Type... types) { checkColumnExists(column); for (Type type : types) { if (column.getType().equals(type)) { return; } } throw new IllegalArgumentException(String.format("%s isn't %s, it's %s", column.getName(), Arrays.toString(types), column.getType().getName())); }
private void checkType(int columnIndex, Type expectedType) { ColumnSchema columnSchema = schema.getColumnByIndex(columnIndex); Type columnType = columnSchema.getType(); if (!columnType.equals(expectedType)) { throw new IllegalArgumentException("Column (name: " + columnSchema.getName() + ", index: " + columnIndex + ") is of type " + columnType.getName() + " but was requested as a type " + expectedType.getName()); } }