diff --git a/jOOQ/src/main/java/org/jooq/LoaderCSVStep.java b/jOOQ/src/main/java/org/jooq/LoaderCSVStep.java index ba5666e3d0..74bc68a843 100644 --- a/jOOQ/src/main/java/org/jooq/LoaderCSVStep.java +++ b/jOOQ/src/main/java/org/jooq/LoaderCSVStep.java @@ -107,12 +107,23 @@ public interface LoaderCSVStep { /** * Indicate that all input fields which have a corresponding field in the * target table (with the same name) should be loaded. - *

- * When {@link LoaderLoadStep#execute() executing the loader} input fields - * for which there is no match in the target table will be logged and if no - * field names can be derived for the input data a - * {@link LoaderConfigurationException} will be reported. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. + * @deprecated - 3.14.0 - [#10010] - Use {@link #fieldsCorresponding()} + * instead. */ + @Deprecated @Support LoaderCSVOptionsStep fieldsFromSource(); + + /** + * Indicate that all input fields which have a corresponding field in the + * target table (with the same name) should be loaded. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. + */ + @Support + LoaderCSVOptionsStep fieldsCorresponding(); } diff --git a/jOOQ/src/main/java/org/jooq/LoaderJSONStep.java b/jOOQ/src/main/java/org/jooq/LoaderJSONStep.java index 63792cd037..3a4f1c8f3e 100644 --- a/jOOQ/src/main/java/org/jooq/LoaderJSONStep.java +++ b/jOOQ/src/main/java/org/jooq/LoaderJSONStep.java @@ -91,12 +91,24 @@ public interface LoaderJSONStep { /** * Indicate that all input fields which have a corresponding field in the * target table (with the same name) should be loaded. - *

- * When {@link LoaderLoadStep#execute() executing the loader} input fields - * for which there is no match in the target table will be logged and if no - * field names can be derived for the input data a - * {@link LoaderConfigurationException} will be reported. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. + * @deprecated - 3.14.0 - [#10010] - Use {@link #fieldsCorresponding()} + * instead. + */ + @Deprecated + @Support + LoaderCSVOptionsStep fieldsFromSource(); + + /** + * Indicate that all input fields which have a corresponding field in the + * target table (with the same name) should be loaded. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. */ @Support - LoaderJSONOptionsStep fieldsFromSource(); + LoaderCSVOptionsStep fieldsCorresponding(); + } diff --git a/jOOQ/src/main/java/org/jooq/LoaderRowsStep.java b/jOOQ/src/main/java/org/jooq/LoaderRowsStep.java index 29ab25f36d..3f88c91860 100644 --- a/jOOQ/src/main/java/org/jooq/LoaderRowsStep.java +++ b/jOOQ/src/main/java/org/jooq/LoaderRowsStep.java @@ -107,12 +107,24 @@ public interface LoaderRowsStep { /** * Indicate that all input fields which have a corresponding field in the * target table (with the same name) should be loaded. - *

- * When {@link LoaderLoadStep#execute() executing the loader} input fields - * for which there is no match in the target table will be logged and if no - * field names can be derived for the input data a - * {@link LoaderConfigurationException} will be reported. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. + * @deprecated - 3.14.0 - [#10010] - Use {@link #fieldsCorresponding()} + * instead. + */ + @Deprecated + @Support + LoaderCSVOptionsStep fieldsFromSource(); + + /** + * Indicate that all input fields which have a corresponding field in the + * target table (with the same name) should be loaded. + * + * @throws LoaderConfigurationException When the source data does not expose + * field names. */ @Support - LoaderListenerStep fieldsFromSource(); + LoaderCSVOptionsStep fieldsCorresponding(); + } diff --git a/jOOQ/src/main/java/org/jooq/impl/LoaderImpl.java b/jOOQ/src/main/java/org/jooq/impl/LoaderImpl.java index 7ac9c842f0..f9d61147aa 100644 --- a/jOOQ/src/main/java/org/jooq/impl/LoaderImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/LoaderImpl.java @@ -159,7 +159,7 @@ final class LoaderImpl implements private Field[] source; private Field[] fields; private LoaderFieldMapper fieldMapper; - private boolean fieldsFromSource; + private boolean fieldsCorresponding; private boolean[] primaryKey; // Result data @@ -552,8 +552,14 @@ final class LoaderImpl implements } @Override + @Deprecated public LoaderImpl fieldsFromSource() { - fieldsFromSource = true; + return fieldsCorresponding(); + } + + @Override + public LoaderImpl fieldsCorresponding() { + fieldsCorresponding = true; return this; } @@ -563,8 +569,8 @@ final class LoaderImpl implements // [#5145] When loading arrays, or when CSV headers are ignored, // the source is still null at this stage. if (source == null) - if (fieldsFromSource) - throw new LoaderConfigurationException("Using fieldsFromSource() requires field names to be available in source."); + if (fieldsCorresponding) + throw new LoaderConfigurationException("Using fieldsCorresponding() requires field names to be available in source."); else source = Tools.fields(row.length); @@ -585,7 +591,7 @@ final class LoaderImpl implements }); } - else if (fieldsFromSource) + else if (fieldsCorresponding) for (int i = 0; i < row.length; i++) { f[i] = table.field(source[i]); if (f[i] == null) @@ -743,7 +749,7 @@ final class LoaderImpl implements row = Arrays.copyOf(row, row.length, Object[].class); // [#5145][#8755] Lazy initialisation of fields from the first row - // in case fields(LoaderFieldMapper) or fieldsFromSource() was used + // in case fields(LoaderFieldMapper) or fieldsCorresponding() was used if (fields == null) fields0(row);