/** * Subclasses may call this method to create {@link TableField} objects that * are linked to this table. * * @param name The name of the field (case-sensitive!) * @param type The data type of the field */ protected static final <R extends Record, T> TableField<R, T> createField(String name, DataType<T> type, Table<R> table, String comment) { final TableFieldImpl<R, T> tableField = new TableFieldImpl<R, T>(name, type, table, comment); // [#1199] The public API of Table returns immutable field lists if (table instanceof TableImpl) { ((TableImpl<?>) table).fields0().add(tableField); } return tableField; }
/** * Subclasses may call this method to create {@link TableField} objects that * are linked to this table. * * @param name The name of the field (case-sensitive!) * @param type The data type of the field */ @SuppressWarnings("unchecked") protected static final <R extends Record, T, X, U> TableField<R, U> createField(String name, DataType<T> type, Table<R> table, String comment, Converter<X, U> converter, Binding<T, X> binding) { final Binding<T, U> actualBinding = DefaultBinding.newBinding(converter, type, binding); final DataType<U> actualType = converter == null && binding == null ? (DataType<U>) type : type.asConvertedDataType(actualBinding); // [#5999] TODO: Allow for user-defined Names final TableFieldImpl<R, U> tableField = new TableFieldImpl<R, U>(DSL.name(name), actualType, table, DSL.comment(comment), actualBinding); // [#1199] The public API of Table returns immutable field lists if (table instanceof TableImpl) { ((TableImpl<?>) table).fields0().add(tableField); } return tableField; }