diff --git a/jOOQ/src/main/java/org/jooq/ArrayComponentConverter.java b/jOOQ/src/main/java/org/jooq/ArrayComponentConverter.java index 1c18e514c7..26e0ac39cd 100644 --- a/jOOQ/src/main/java/org/jooq/ArrayComponentConverter.java +++ b/jOOQ/src/main/java/org/jooq/ArrayComponentConverter.java @@ -56,7 +56,7 @@ final class ArrayComponentConverter extends AbstractScopedConverter } @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { if (t == null) return null; @@ -66,7 +66,7 @@ final class ArrayComponentConverter extends AbstractScopedConverter } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { if (u == null) return null; diff --git a/jOOQ/src/main/java/org/jooq/ArrayConverter.java b/jOOQ/src/main/java/org/jooq/ArrayConverter.java index 269a905f00..7afb0afdb1 100644 --- a/jOOQ/src/main/java/org/jooq/ArrayConverter.java +++ b/jOOQ/src/main/java/org/jooq/ArrayConverter.java @@ -61,12 +61,12 @@ final class ArrayConverter extends AbstractScopedConverter { } @Override - public final U[] from(T[] t, ConverterScope scope) { + public final U[] from(T[] t, ConverterContext scope) { return Convert.convertArray(t, converter); } @Override - public final T[] to(U[] t, ConverterScope scope) { + public final T[] to(U[] t, ConverterContext scope) { return Convert.convertArray(t, inverse); } } diff --git a/jOOQ/src/main/java/org/jooq/BindingScope.java b/jOOQ/src/main/java/org/jooq/BindingScope.java index 9fd29dfe72..8c721b0b07 100644 --- a/jOOQ/src/main/java/org/jooq/BindingScope.java +++ b/jOOQ/src/main/java/org/jooq/BindingScope.java @@ -99,8 +99,8 @@ import java.sql.SQLOutput; public interface BindingScope extends Scope { /** - * Get the {@link ConverterScope} from the context of this + * Get the {@link ConverterContext} from the context of this * {@link BindingScope}. */ - ConverterScope converterScope(); + ConverterContext converterContext(); } diff --git a/jOOQ/src/main/java/org/jooq/Converter.java b/jOOQ/src/main/java/org/jooq/Converter.java index b1c8f0b8f2..741f655412 100644 --- a/jOOQ/src/main/java/org/jooq/Converter.java +++ b/jOOQ/src/main/java/org/jooq/Converter.java @@ -175,12 +175,12 @@ public interface Converter extends Serializable { return new AbstractScopedConverter(fromType, toType) { @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { return from.apply(t); } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { return to.apply(u); } }; diff --git a/jOOQ/src/main/java/org/jooq/ConverterScope.java b/jOOQ/src/main/java/org/jooq/ConverterContext.java similarity index 95% rename from jOOQ/src/main/java/org/jooq/ConverterScope.java rename to jOOQ/src/main/java/org/jooq/ConverterContext.java index b3a9b5b58b..ad1bc4f7a2 100644 --- a/jOOQ/src/main/java/org/jooq/ConverterScope.java +++ b/jOOQ/src/main/java/org/jooq/ConverterContext.java @@ -43,6 +43,6 @@ package org.jooq; *

* Implementations */ -public interface ConverterScope extends Scope { +public interface ConverterContext extends Scope { } diff --git a/jOOQ/src/main/java/org/jooq/Converters.java b/jOOQ/src/main/java/org/jooq/Converters.java index 7fa60b6000..f778c1a7dd 100644 --- a/jOOQ/src/main/java/org/jooq/Converters.java +++ b/jOOQ/src/main/java/org/jooq/Converters.java @@ -195,7 +195,7 @@ public final class Converters extends AbstractScopedConverter { } @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { Object result = t; for (int i = 0; i < chain.length; i++) @@ -205,7 +205,7 @@ public final class Converters extends AbstractScopedConverter { } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { Object result = u; for (int i = chain.length - 1; i >= 0; i--) @@ -237,9 +237,9 @@ public final class Converters extends AbstractScopedConverter { : f.apply(t) : t -> t == null ? null : f.apply(t); } - static final BiFunction nullable(BiFunction f) { + static final BiFunction nullable(BiFunction f) { return f instanceof Serializable - ? (BiFunction & Serializable) (t, x) -> t == null ? null + ? (BiFunction & Serializable) (t, x) -> t == null ? null : f.apply(t, x) : (t, x) -> t == null ? null : f.apply(t, x); } @@ -247,7 +247,7 @@ public final class Converters extends AbstractScopedConverter { return t -> { throw new DataTypeException("Conversion function not implemented"); }; } - static final BiFunction notImplementedBiFunction() { + static final BiFunction notImplementedBiFunction() { return (t, x) -> { throw new DataTypeException("Conversion function not implemented"); }; } diff --git a/jOOQ/src/main/java/org/jooq/ExecuteContext.java b/jOOQ/src/main/java/org/jooq/ExecuteContext.java index e206316a65..6ff11d0d19 100644 --- a/jOOQ/src/main/java/org/jooq/ExecuteContext.java +++ b/jOOQ/src/main/java/org/jooq/ExecuteContext.java @@ -72,10 +72,10 @@ import org.jetbrains.annotations.Nullable; public interface ExecuteContext extends Scope { /** - * Get a {@link ConverterScope} for the scope of this + * Get a {@link ConverterContext} for the scope of this * {@link ExecuteContext}. */ - ConverterScope converterScope(); + ConverterContext converterContext(); /** * The connection to be used in this execute context. diff --git a/jOOQ/src/main/java/org/jooq/ExecuteScope.java b/jOOQ/src/main/java/org/jooq/ExecuteScope.java index f9ab9d87fe..f571dfb895 100644 --- a/jOOQ/src/main/java/org/jooq/ExecuteScope.java +++ b/jOOQ/src/main/java/org/jooq/ExecuteScope.java @@ -45,10 +45,10 @@ import org.jetbrains.annotations.Nullable; public interface ExecuteScope extends Scope { /** - * Get the {@link ConverterScope} from the context of this + * Get the {@link ConverterContext} from the context of this * {@link ExecuteScope}. */ - ConverterScope converterScope(); + ConverterContext converterContext(); /** * The {@link ExecuteContext} that created this scope. diff --git a/jOOQ/src/main/java/org/jooq/ScopedConverter.java b/jOOQ/src/main/java/org/jooq/ScopedConverter.java index 1464c2450b..faed763376 100644 --- a/jOOQ/src/main/java/org/jooq/ScopedConverter.java +++ b/jOOQ/src/main/java/org/jooq/ScopedConverter.java @@ -39,7 +39,7 @@ package org.jooq; import static org.jooq.Converters.notImplementedBiFunction; import static org.jooq.Converters.nullable; -import static org.jooq.impl.Internal.converterScope; +import static org.jooq.impl.Internal.converterContext; import java.util.function.BiFunction; import java.util.function.Function; @@ -50,12 +50,12 @@ import org.jetbrains.annotations.NotNull; /** * A special type of {@link Converter} with alternative - * {@link #from(Object, ConverterScope)} and {@link #to(Object, ConverterScope)} + * {@link #from(Object, ConverterContext)} and {@link #to(Object, ConverterContext)} * methods. *

* This special converter type can be used wherever an ordinary * {@link Converter} is used. jOOQ internal call sites will call the alternative - * {@link #from(Object, ConverterScope)} and {@link #to(Object, ConverterScope)} + * {@link #from(Object, ConverterContext)} and {@link #to(Object, ConverterContext)} * methods, instead of {@link #from(Object)} and {@link #to(Object)}, allowing * for accessing global {@link Configuration#data()} content. */ @@ -68,7 +68,7 @@ public interface ScopedConverter extends Converter { * @param scope The scope of this conversion. * @return The user object. */ - U from(T databaseObject, ConverterScope scope); + U from(T databaseObject, ConverterContext scope); /** * Convert and write a user object to a database object. @@ -77,16 +77,16 @@ public interface ScopedConverter extends Converter { * @param scope The scope of this conversion. * @return The database object. */ - T to(U userObject, ConverterScope scope); + T to(U userObject, ConverterContext scope); @Override default T to(U userObject) { - return to(userObject, converterScope()); + return to(userObject, converterContext()); } @Override default U from(T databaseObject) { - return from(databaseObject, converterScope()); + return from(databaseObject, converterContext()); } /** @@ -126,12 +126,12 @@ public interface ScopedConverter extends Converter { else return new AbstractScopedConverter(converter.fromType(), converter.toType()) { @Override - public U from(T t, ConverterScope scope) { + public U from(T t, ConverterContext scope) { return converter.from(t); } @Override - public T to(U u, ConverterScope scope) { + public T to(U u, ConverterContext scope) { return converter.to(u); } }; @@ -154,7 +154,7 @@ public interface ScopedConverter extends Converter { static ScopedConverter from( Class fromType, Class toType, - BiFunction from + BiFunction from ) { return of(fromType, toType, from, notImplementedBiFunction()); } @@ -176,7 +176,7 @@ public interface ScopedConverter extends Converter { static ScopedConverter to( Class fromType, Class toType, - BiFunction to + BiFunction to ) { return of(fromType, toType, notImplementedBiFunction(), to); } @@ -198,18 +198,18 @@ public interface ScopedConverter extends Converter { static ScopedConverter of( Class fromType, Class toType, - BiFunction from, - BiFunction to + BiFunction from, + BiFunction to ) { return new AbstractScopedConverter(fromType, toType) { @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { return from.apply(t, scope); } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { return to.apply(u, scope); } }; @@ -248,8 +248,8 @@ public interface ScopedConverter extends Converter { static ScopedConverter ofNullable( Class fromType, Class toType, - BiFunction from, - BiFunction to + BiFunction from, + BiFunction to ) { return of(fromType, toType, nullable(from), nullable(to)); } @@ -284,7 +284,7 @@ public interface ScopedConverter extends Converter { static Converter fromNullable( Class fromType, Class toType, - BiFunction from + BiFunction from ) { return of(fromType, toType, nullable(from), notImplementedBiFunction()); } @@ -318,7 +318,7 @@ public interface ScopedConverter extends Converter { static Converter toNullable( Class fromType, Class toType, - BiFunction to + BiFunction to ) { return of(fromType, toType, notImplementedBiFunction(), nullable(to)); } diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java b/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java index 6ed63b5683..be2886a721 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractContext.java @@ -78,7 +78,7 @@ import org.jooq.Clause; import org.jooq.Condition; import org.jooq.Configuration; import org.jooq.Context; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.DSLContext; import org.jooq.ExecuteContext; import org.jooq.Field; @@ -237,8 +237,8 @@ abstract class AbstractContext> extends AbstractScope imple // ------------------------------------------------------------------------ @Override - public final ConverterScope converterScope() { - return ctx != null ? ctx.converterScope() : Tools.converterScope(configuration()); + public final ConverterContext converterContext() { + return ctx != null ? ctx.converterContext() : Tools.converterContext(configuration()); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractExecuteScope.java b/jOOQ/src/main/java/org/jooq/impl/AbstractExecuteScope.java index 2e7ad9a024..6a22739cb6 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractExecuteScope.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractExecuteScope.java @@ -37,7 +37,7 @@ */ package org.jooq.impl; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.ExecuteContext; import org.jooq.ExecuteScope; @@ -57,8 +57,8 @@ abstract class AbstractExecuteScope extends AbstractScope implements ExecuteScop } @Override - public final ConverterScope converterScope() { - return ctx.converterScope(); + public final ConverterContext converterContext() { + return ctx.converterContext(); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java b/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java index bb52caa0d8..fa4dacc474 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractRecord.java @@ -44,7 +44,7 @@ import static org.jooq.ScopedConverter.scoped; import static org.jooq.conf.SettingsTools.updatablePrimaryKeys; import static org.jooq.impl.Tools.EMPTY_FIELD; import static org.jooq.impl.Tools.converterOrFail; -import static org.jooq.impl.Tools.converterScope; +import static org.jooq.impl.Tools.converterContext; import static org.jooq.impl.Tools.embeddedFields; import static org.jooq.impl.Tools.indexFail; import static org.jooq.impl.Tools.indexOrFail; @@ -336,12 +336,12 @@ abstract class AbstractRecord extends AbstractStore implements Record { @Override public final U get(Field field, Class type) { Object t = get(field); - return (U) converterOrFail(this, t, (Class) field.getType(), type).from(t, converterScope(this)); + return (U) converterOrFail(this, t, (Class) field.getType(), type).from(t, converterContext(this)); } @Override public final U get(Field field, Converter converter) { - return scoped(converter).from(get(field), converterScope(this)); + return scoped(converter).from(get(field), converterContext(this)); } @Override @@ -352,7 +352,7 @@ abstract class AbstractRecord extends AbstractStore implements Record { @Override public final U get(int index, Class type) { Object t = get(index); - return (U) converterOrFail(this, t, (Class) field(safeIndex(index)).getType(), type).from(t, converterScope(this)); + return (U) converterOrFail(this, t, (Class) field(safeIndex(index)).getType(), type).from(t, converterContext(this)); } @Override @@ -475,7 +475,7 @@ abstract class AbstractRecord extends AbstractStore implements Record { @Override public final void set(Field field, U value, Converter converter) { - set(field, scoped(converter).to(value, converterScope(this))); + set(field, scoped(converter).to(value, converterContext(this))); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractXMLasObjectBinding.java b/jOOQ/src/main/java/org/jooq/impl/AbstractXMLasObjectBinding.java index 0ff686a796..8d45616c30 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractXMLasObjectBinding.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractXMLasObjectBinding.java @@ -56,7 +56,7 @@ import jakarta.xml.bind.annotation.XmlRootElement; import javax.xml.namespace.QName; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.XML; /** @@ -103,7 +103,7 @@ public class AbstractXMLasObjectBinding extends AbstractXMLBinding { } @Override - public T from(XML t, ConverterScope scope) { + public T from(XML t, ConverterContext scope) { if (t == null) return null; @@ -111,7 +111,7 @@ public class AbstractXMLasObjectBinding extends AbstractXMLBinding { } @Override - public XML to(T u, ConverterScope scope) { + public XML to(T u, ConverterContext scope) { if (u == null) return null; diff --git a/jOOQ/src/main/java/org/jooq/impl/Convert.java b/jOOQ/src/main/java/org/jooq/impl/Convert.java index bc2b8b789e..349b8a2bd7 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Convert.java +++ b/jOOQ/src/main/java/org/jooq/impl/Convert.java @@ -42,7 +42,7 @@ import static java.time.temporal.ChronoField.MILLI_OF_DAY; import static java.time.temporal.ChronoField.MILLI_OF_SECOND; import static org.jooq.ScopedConverter.scoped; import static org.jooq.impl.Internal.arrayType; -import static org.jooq.impl.Internal.converterScope; +import static org.jooq.impl.Internal.converterContext; import static org.jooq.impl.Tools.configuration; import static org.jooq.impl.Tools.emulateMultiset; import static org.jooq.tools.reflect.Reflect.accessible; @@ -95,7 +95,7 @@ import java.util.regex.Pattern; // ... import org.jooq.Converter; import org.jooq.ConverterProvider; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.EnumType; import org.jooq.Field; import org.jooq.JSON; @@ -403,7 +403,7 @@ final class Convert { } static final U[] convertCollection(Collection from, Class to){ - return new ConvertAll(to).from(from, converterScope()); + return new ConvertAll(to).from(from, converterContext()); } /** @@ -433,10 +433,10 @@ final class Convert { Class fromType = converter.fromType(); if (fromType == Object.class) - return scoped(converter).from((T) from, converterScope()); + return scoped(converter).from((T) from, converterContext()); ConvertAll convertAll = new ConvertAll<>(fromType); - return scoped(converter).from(convertAll.from(from, converterScope()), converterScope()); + return scoped(converter).from(convertAll.from(from, converterContext()), converterContext()); } /** @@ -547,7 +547,7 @@ final class Convert { List result = new ArrayList<>(collection.size()); for (Object o : collection) - result.add(convert(all.from(o, converterScope()), converter)); + result.add(convert(all.from(o, converterContext()), converter)); return result; } @@ -573,7 +573,7 @@ final class Convert { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public U from(Object from, ConverterScope scope) { + public U from(Object from, ConverterContext scope) { if (from == null) { // [#936] If types are converted to primitives, the result must not @@ -1402,7 +1402,7 @@ final class Convert { } @Override - public Object to(U to, ConverterScope scope) { + public Object to(U to, ConverterContext scope) { return to; } diff --git a/jOOQ/src/main/java/org/jooq/impl/ConvertedDataType.java b/jOOQ/src/main/java/org/jooq/impl/ConvertedDataType.java index ee7fc2b7b1..222da47377 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ConvertedDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/ConvertedDataType.java @@ -37,7 +37,7 @@ */ package org.jooq.impl; -import static org.jooq.impl.Internal.converterScope; +import static org.jooq.impl.Internal.converterContext; import java.util.List; import java.util.Map; @@ -309,7 +309,7 @@ final class ConvertedDataType extends AbstractDataTypeX { // [#3200] Try to convert arbitrary objects to T else - return ((ScopedConverter) getConverter()).from(delegate.convert(object), converterScope()); + return ((ScopedConverter) getConverter()).from(delegate.convert(object), converterContext()); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java index 7a081f372a..56d3303117 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CursorImpl.java @@ -1571,7 +1571,7 @@ final class CursorImpl extends AbstractCursor { // [#7100] TODO: Is there a more elegant way to do this? if (f != field) - value = ((ScopedConverter) field.getConverter()).from(value, ctx.converterScope()); + value = ((ScopedConverter) field.getConverter()).from(value, ctx.converterContext()); offset += operation.offset - nestedOffset + nested.size() - 1; } diff --git a/jOOQ/src/main/java/org/jooq/impl/DateToLocalDateConverter.java b/jOOQ/src/main/java/org/jooq/impl/DateToLocalDateConverter.java index 94df5355f9..e3d20f50b8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DateToLocalDateConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/DateToLocalDateConverter.java @@ -42,7 +42,7 @@ import java.time.LocalDate; import java.util.function.Function; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; /** * @author Lukas Eder @@ -59,12 +59,12 @@ public final class DateToLocalDateConverter extends AbstractScopedConverter implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Date.class, LocalDate.class, - (BiFunction & Serializable) (t, x) -> t.toLocalDate(), - (BiFunction & Serializable) (t, x) -> Date.valueOf(t) + (BiFunction & Serializable) (t, x) -> t.toLocalDate(), + (BiFunction & Serializable) (t, x) -> Date.valueOf(t) ), (ScopedConverter) converter, c -> new DefaultDateBinding<>(DATE, c) @@ -386,8 +386,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Timestamp.class, LocalDateTime.class, - (BiFunction & Serializable) (t, x) -> t.toLocalDateTime(), - (BiFunction & Serializable) (t, x) -> Timestamp.valueOf(t) + (BiFunction & Serializable) (t, x) -> t.toLocalDateTime(), + (BiFunction & Serializable) (t, x) -> Timestamp.valueOf(t) ), (ScopedConverter) converter, c -> new DefaultTimestampBinding<>(TIMESTAMP, c) @@ -396,8 +396,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Time.class, LocalTime.class, - (BiFunction & Serializable) (t, x) -> t.toLocalTime(), - (BiFunction & Serializable) (t, x) -> Time.valueOf(t) + (BiFunction & Serializable) (t, x) -> t.toLocalTime(), + (BiFunction & Serializable) (t, x) -> Time.valueOf(t) ), (ScopedConverter) converter, c -> new DefaultTimeBinding<>(TIME, c) @@ -430,8 +430,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Short.class, UByte.class, - (BiFunction & Serializable) (t, x) -> UByte.valueOf(t), - (BiFunction & Serializable) (t, x) -> t.shortValue() + (BiFunction & Serializable) (t, x) -> UByte.valueOf(t), + (BiFunction & Serializable) (t, x) -> t.shortValue() ), (ScopedConverter) converter, c -> new DefaultShortBinding<>(SMALLINT, c) @@ -440,8 +440,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Long.class, UInteger.class, - (BiFunction & Serializable) (t, x) -> UInteger.valueOf(t), - (BiFunction & Serializable) (t, x) -> t.longValue() + (BiFunction & Serializable) (t, x) -> UInteger.valueOf(t), + (BiFunction & Serializable) (t, x) -> t.longValue() ), (ScopedConverter) converter, c -> new DefaultLongBinding<>(BIGINT, c) @@ -450,8 +450,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(BigInteger.class, ULong.class, - (BiFunction & Serializable) (t, x) -> ULong.valueOf(t), - (BiFunction & Serializable) (t, x) -> t.toBigInteger() + (BiFunction & Serializable) (t, x) -> ULong.valueOf(t), + (BiFunction & Serializable) (t, x) -> t.toBigInteger() ), (ScopedConverter) converter, c -> new DefaultBigIntegerBinding<>(DECIMAL_INTEGER, c) @@ -460,8 +460,8 @@ public class DefaultBinding implements Binding { return (Binding) new DelegatingBinding<>( (DataType) dataType, ScopedConverter.ofNullable(Integer.class, UShort.class, - (BiFunction & Serializable) (t, x) -> UShort.valueOf(t), - (BiFunction & Serializable) (t, x) -> t.intValue() + (BiFunction & Serializable) (t, x) -> UShort.valueOf(t), + (BiFunction & Serializable) (t, x) -> t.intValue() ), (ScopedConverter) converter, c -> new DefaultIntegerBinding<>(INTEGER, c) @@ -940,7 +940,7 @@ public class DefaultBinding implements Binding { @Override public final void sql(BindingSQLContext ctx) throws SQLException { - T converted = converter().to(ctx.value(), ctx.converterScope()); + T converted = converter().to(ctx.value(), ctx.converterContext()); // Casting can be enforced or prevented switch (ctx.render().castMode()) { @@ -1000,7 +1000,7 @@ public class DefaultBinding implements Binding { @Override public final void set(BindingSetStatementContext ctx) throws SQLException { - T value = converter().to(ctx.value(), ctx.converterScope()); + T value = converter().to(ctx.value(), ctx.converterContext()); if (!FALSE.equals(ctx.settings().isExecuteLogging())) if (log.isTraceEnabled()) @@ -1017,7 +1017,7 @@ public class DefaultBinding implements Binding { @Override public final void set(BindingSetSQLOutputContext ctx) throws SQLException { - T value = converter().to(ctx.value(), ctx.converterScope()); + T value = converter().to(ctx.value(), ctx.converterContext()); if (value == null) ctx.output().writeObject(null); @@ -1027,7 +1027,7 @@ public class DefaultBinding implements Binding { @Override public final void get(BindingGetResultSetContext ctx) throws SQLException { - U value = converter().from(get0(ctx), ctx.converterScope()); + U value = converter().from(get0(ctx), ctx.converterContext()); if (attachable) value = attach(value, ctx.configuration()); @@ -1037,7 +1037,7 @@ public class DefaultBinding implements Binding { @Override public final void get(BindingGetStatementContext ctx) throws SQLException { - U value = converter().from(get0(ctx), ctx.converterScope()); + U value = converter().from(get0(ctx), ctx.converterContext()); if (attachable) value = attach(value, ctx.configuration()); @@ -1047,7 +1047,7 @@ public class DefaultBinding implements Binding { @Override public final void get(BindingGetSQLInputContext ctx) throws SQLException { - U value = converter().from(get0(ctx), ctx.converterScope()); + U value = converter().from(get0(ctx), ctx.converterContext()); if (attachable) value = attach(value, ctx.configuration()); @@ -1129,17 +1129,17 @@ public class DefaultBinding implements Binding { @Override final void sqlInline0(BindingSQLContext ctx, X value) throws SQLException { - delegatingBinding.sqlInline0(ctx, delegatingConverter.to(value, ctx.converterScope())); + delegatingBinding.sqlInline0(ctx, delegatingConverter.to(value, ctx.converterContext())); } @Override final void sqlBind0(BindingSQLContext ctx, X value) throws SQLException { - delegatingBinding.sqlBind0(ctx, delegatingConverter.to(value, ctx.converterScope())); + delegatingBinding.sqlBind0(ctx, delegatingConverter.to(value, ctx.converterContext())); } @Override final void set0(BindingSetStatementContext ctx, X value) throws SQLException { - delegatingBinding.set0(ctx, delegatingConverter.to(value, ctx.converterScope())); + delegatingBinding.set0(ctx, delegatingConverter.to(value, ctx.converterContext())); } @Override @@ -1149,22 +1149,22 @@ public class DefaultBinding implements Binding { @Override final void set0(BindingSetSQLOutputContext ctx, X value) throws SQLException { - delegatingBinding.set0(ctx, delegatingConverter.to(value, ctx.converterScope())); + delegatingBinding.set0(ctx, delegatingConverter.to(value, ctx.converterContext())); } @Override final X get0(BindingGetResultSetContext ctx) throws SQLException { - return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterScope()); + return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterContext()); } @Override final X get0(BindingGetStatementContext ctx) throws SQLException { - return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterScope()); + return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterContext()); } @Override final X get0(BindingGetSQLInputContext ctx) throws SQLException { - return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterScope()); + return delegatingConverter.from(delegatingBinding.get0(ctx), ctx.converterContext()); } @Override @@ -3463,8 +3463,8 @@ public class DefaultBinding implements Binding { private static final ScopedConverter CONVERTER = ScopedConverter.ofNullable( OffsetDateTime.class, Instant.class, - (BiFunction & Serializable) (t, x) -> t.toInstant(), - (BiFunction & Serializable) (i, x) -> OffsetDateTime.ofInstant(i, ZoneOffset.UTC) + (BiFunction & Serializable) (t, x) -> t.toInstant(), + (BiFunction & Serializable) (i, x) -> OffsetDateTime.ofInstant(i, ZoneOffset.UTC) ); private final DefaultOffsetDateTimeBinding delegate; @@ -3482,32 +3482,32 @@ public class DefaultBinding implements Binding { @Override final void sqlInline0(BindingSQLContext ctx, Instant value) throws SQLException { - delegate.sqlInline0(ctx, CONVERTER.to(value, ctx.converterScope())); + delegate.sqlInline0(ctx, CONVERTER.to(value, ctx.converterContext())); } @Override final void set0(BindingSetStatementContext ctx, Instant value) throws SQLException { - delegate.set0(ctx, CONVERTER.to(value, ctx.converterScope())); + delegate.set0(ctx, CONVERTER.to(value, ctx.converterContext())); } @Override final void set0(BindingSetSQLOutputContext ctx, Instant value) throws SQLException { - delegate.set0(ctx, CONVERTER.to(value, ctx.converterScope())); + delegate.set0(ctx, CONVERTER.to(value, ctx.converterContext())); } @Override final Instant get0(BindingGetResultSetContext ctx) throws SQLException { - return CONVERTER.from(delegate.get0(ctx), ctx.converterScope()); + return CONVERTER.from(delegate.get0(ctx), ctx.converterContext()); } @Override final Instant get0(BindingGetStatementContext ctx) throws SQLException { - return CONVERTER.from(delegate.get0(ctx), ctx.converterScope()); + return CONVERTER.from(delegate.get0(ctx), ctx.converterContext()); } @Override final Instant get0(BindingGetSQLInputContext ctx) throws SQLException { - return CONVERTER.from(delegate.get0(ctx), ctx.converterScope()); + return CONVERTER.from(delegate.get0(ctx), ctx.converterContext()); } @Override @@ -3856,88 +3856,88 @@ public class DefaultBinding implements Binding { else if (type == Blob.class) ; // Not supported else if (type == Boolean.class) - return converter.from((T) Convert.convert(string, Boolean.class), ctx.converterScope()); + return converter.from((T) Convert.convert(string, Boolean.class), ctx.converterContext()); else if (type == BigInteger.class) - return converter.from((T) new BigInteger(string), ctx.converterScope()); + return converter.from((T) new BigInteger(string), ctx.converterContext()); else if (type == BigDecimal.class) - return converter.from((T) new BigDecimal(string), ctx.converterScope()); + return converter.from((T) new BigDecimal(string), ctx.converterContext()); else if (type == Byte.class) - return converter.from((T) Byte.valueOf(string), ctx.converterScope()); + return converter.from((T) Byte.valueOf(string), ctx.converterContext()); else if (type == byte[].class) - return converter.from((T) PostgresUtils.toBytes(string), ctx.converterScope()); + return converter.from((T) PostgresUtils.toBytes(string), ctx.converterContext()); else if (type == Clob.class) ; // Not supported else if (type == Date.class) - return converter.from((T) Date.valueOf(string), ctx.converterScope()); + return converter.from((T) Date.valueOf(string), ctx.converterContext()); else if (type == Double.class) - return converter.from((T) Double.valueOf(string), ctx.converterScope()); + return converter.from((T) Double.valueOf(string), ctx.converterContext()); else if (type == Float.class) - return converter.from((T) Float.valueOf(string), ctx.converterScope()); + return converter.from((T) Float.valueOf(string), ctx.converterContext()); else if (type == Integer.class) - return converter.from((T) Integer.valueOf(string), ctx.converterScope()); + return converter.from((T) Integer.valueOf(string), ctx.converterContext()); else if (type == Long.class) - return converter.from((T) Long.valueOf(string), ctx.converterScope()); + return converter.from((T) Long.valueOf(string), ctx.converterContext()); else if (type == Short.class) - return converter.from((T) Short.valueOf(string), ctx.converterScope()); + return converter.from((T) Short.valueOf(string), ctx.converterContext()); else if (type == String.class) - return converter.from((T) string, ctx.converterScope()); + return converter.from((T) string, ctx.converterContext()); else if (type == Time.class) - return converter.from((T) Time.valueOf(string), ctx.converterScope()); + return converter.from((T) Time.valueOf(string), ctx.converterContext()); else if (type == Timestamp.class) - return converter.from((T) Timestamp.valueOf(patchIso8601Timestamp(string, false)), ctx.converterScope()); + return converter.from((T) Timestamp.valueOf(patchIso8601Timestamp(string, false)), ctx.converterContext()); else if (type == LocalTime.class) - return converter.from((T) LocalTime.parse(string), ctx.converterScope()); + return converter.from((T) LocalTime.parse(string), ctx.converterContext()); else if (type == LocalDate.class) - return converter.from((T) LocalDate.parse(string), ctx.converterScope()); + return converter.from((T) LocalDate.parse(string), ctx.converterContext()); else if (type == LocalDateTime.class) - return converter.from((T) LocalDateTime.parse(patchIso8601Timestamp(string, true)), ctx.converterScope()); + return converter.from((T) LocalDateTime.parse(patchIso8601Timestamp(string, true)), ctx.converterContext()); else if (type == OffsetTime.class) - return converter.from((T) OffsetDateTimeParser.offsetTime(string), ctx.converterScope()); + return converter.from((T) OffsetDateTimeParser.offsetTime(string), ctx.converterContext()); else if (type == OffsetDateTime.class) - return converter.from((T) OffsetDateTimeParser.offsetDateTime(string), ctx.converterScope()); + return converter.from((T) OffsetDateTimeParser.offsetDateTime(string), ctx.converterContext()); else if (type == Instant.class) - return converter.from((T) OffsetDateTimeParser.offsetDateTime(string).toInstant(), ctx.converterScope()); + return converter.from((T) OffsetDateTimeParser.offsetDateTime(string).toInstant(), ctx.converterContext()); else if (type == JSON.class) - return converter.from((T) JSON.json(string), ctx.converterScope()); + return converter.from((T) JSON.json(string), ctx.converterContext()); else if (type == JSONB.class) - return converter.from((T) JSONB.jsonb(string), ctx.converterScope()); + return converter.from((T) JSONB.jsonb(string), ctx.converterContext()); else if (type == UByte.class) - return converter.from((T) UByte.valueOf(string), ctx.converterScope()); + return converter.from((T) UByte.valueOf(string), ctx.converterContext()); else if (type == UShort.class) - return converter.from((T) UShort.valueOf(string), ctx.converterScope()); + return converter.from((T) UShort.valueOf(string), ctx.converterContext()); else if (type == UInteger.class) - return converter.from((T) UInteger.valueOf(string), ctx.converterScope()); + return converter.from((T) UInteger.valueOf(string), ctx.converterContext()); else if (type == ULong.class) - return converter.from((T) ULong.valueOf(string), ctx.converterScope()); + return converter.from((T) ULong.valueOf(string), ctx.converterContext()); else if (type == UUID.class) - return converter.from((T) UUID.fromString(string), ctx.converterScope()); + return converter.from((T) UUID.fromString(string), ctx.converterContext()); else if (type == XML.class) - return converter.from((T) XML.xml(string), ctx.converterScope()); + return converter.from((T) XML.xml(string), ctx.converterContext()); else if (type.isArray()) - return converter.from((T) pgNewArray(ctx, field, type, string), ctx.converterScope()); + return converter.from((T) pgNewArray(ctx, field, type, string), ctx.converterContext()); else if (EnumType.class.isAssignableFrom(type)) - return converter.from((T) DefaultEnumTypeBinding.getEnumType((Class) type, string), ctx.converterScope()); + return converter.from((T) DefaultEnumTypeBinding.getEnumType((Class) type, string), ctx.converterContext()); else if (Result.class.isAssignableFrom(type)) if (string.startsWith("<")) - return converter.from((T) readMultisetXML(ctx, (AbstractRow) field.getDataType().getRow(), (Class) field.getDataType().getRecordType(), string), ctx.converterScope()); + return converter.from((T) readMultisetXML(ctx, (AbstractRow) field.getDataType().getRow(), (Class) field.getDataType().getRecordType(), string), ctx.converterContext()); else - return converter.from((T) readMultisetJSON(ctx, (AbstractRow) field.getDataType().getRow(), (Class) field.getDataType().getRecordType(), string), ctx.converterScope()); + return converter.from((T) readMultisetJSON(ctx, (AbstractRow) field.getDataType().getRow(), (Class) field.getDataType().getRecordType(), string), ctx.converterContext()); else if (Record.class.isAssignableFrom(type) // [#11812] UDTRecords/TableRecords or InternalRecords that don't have an explicit converter && (!InternalRecord.class.isAssignableFrom(type) || type == converter.fromType())) - return converter.from((T) pgNewRecord(ctx, type, (AbstractRow) field.getDataType().getRow(), string), ctx.converterScope()); + return converter.from((T) pgNewRecord(ctx, type, (AbstractRow) field.getDataType().getRow(), string), ctx.converterContext()); else if (type == Object.class) - return converter.from((T) string, ctx.converterScope()); + return converter.from((T) string, ctx.converterContext()); // [#4964] [#6058] Recurse only if we have a meaningful converter, not the identity converter, // which would cause a StackOverflowError, here! else if (type != wrapper(converter.toType())) { - return converter.from((T) pgFromString(ctx, field("converted_field", ((ConvertedDataType) field.getDataType()).delegate()), string), ctx.converterScope()); + return converter.from((T) pgFromString(ctx, field("converted_field", ((ConvertedDataType) field.getDataType()).delegate()), string), ctx.converterContext()); } throw new UnsupportedOperationException("Class " + type + " is not supported"); @@ -5416,7 +5416,7 @@ public class DefaultBinding implements Binding { @Override void sqlInline0(BindingSQLContext ctx, JSONB value) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) { - bytes(ctx.configuration()).sqlInline0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterScope())); + bytes(ctx.configuration()).sqlInline0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterContext())); } else { super.sqlInline0(ctx, value); @@ -5437,7 +5437,7 @@ public class DefaultBinding implements Binding { @Override final void set0(BindingSetStatementContext ctx, JSONB value) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) - bytes(ctx.configuration()).set0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterScope())); + bytes(ctx.configuration()).set0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterContext())); else ctx.statement().setString(ctx.index(), value.data()); } @@ -5445,7 +5445,7 @@ public class DefaultBinding implements Binding { @Override final void set0(BindingSetSQLOutputContext ctx, JSONB value) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) - bytes(ctx.configuration()).set0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterScope())); + bytes(ctx.configuration()).set0(ctx, bytesConverter(ctx.configuration()).to(value, ctx.converterContext())); else ctx.output().writeString(value.data()); } @@ -5453,7 +5453,7 @@ public class DefaultBinding implements Binding { @Override final JSONB get0(BindingGetResultSetContext ctx) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) - return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterScope()); + return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterContext()); String string = ctx.resultSet().getString(ctx.index()); return string == null ? null : JSONB.valueOf(string); @@ -5462,7 +5462,7 @@ public class DefaultBinding implements Binding { @Override final JSONB get0(BindingGetStatementContext ctx) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) - return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterScope()); + return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterContext()); String string = ctx.statement().getString(ctx.index()); return string == null ? null : JSONB.valueOf(string); @@ -5471,7 +5471,7 @@ public class DefaultBinding implements Binding { @Override final JSONB get0(BindingGetSQLInputContext ctx) throws SQLException { if (EMULATE_AS_BLOB.contains(ctx.dialect())) - return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterScope()); + return bytesConverter(ctx.configuration()).from(bytes(ctx.configuration()).get0(ctx), ctx.converterContext()); String string = ctx.input().readString(); return string == null ? null : JSONB.valueOf(string); diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetResultSetContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetResultSetContext.java index adabcc432a..939bda27b8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetResultSetContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetResultSetContext.java @@ -103,7 +103,7 @@ class DefaultBindingGetResultSetContext extends AbstractExecuteScope implemen return new DefaultBindingGetResultSetContext(ctx, resultSet, index) { @Override public void value(T v) { - outer.value(scoped(converter).from(v, converterScope())); + outer.value(scoped(converter).from(v, converterContext())); } }; } diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetSQLInputContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetSQLInputContext.java index 1ae1434614..645878e312 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetSQLInputContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetSQLInputContext.java @@ -80,7 +80,7 @@ class DefaultBindingGetSQLInputContext extends AbstractExecuteScope implement return new DefaultBindingGetSQLInputContext(ctx, input) { @Override public void value(T v) { - outer.value(scoped(converter).from(v, converterScope())); + outer.value(scoped(converter).from(v, converterContext())); } }; } diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetStatementContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetStatementContext.java index 1ce2e7c0b1..56e2e98939 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetStatementContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingGetStatementContext.java @@ -88,7 +88,7 @@ class DefaultBindingGetStatementContext extends AbstractExecuteScope implemen return new DefaultBindingGetStatementContext(ctx, statement, index) { @Override public void value(T v) { - outer.value(scoped(converter).from(v, converterScope())); + outer.value(scoped(converter).from(v, converterContext())); } }; } diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSQLContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSQLContext.java index 21bbf6a186..5052c946ee 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSQLContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSQLContext.java @@ -44,7 +44,7 @@ import java.util.Map; import org.jooq.BindingSQLContext; import org.jooq.Configuration; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.RenderContext; /** @@ -69,8 +69,8 @@ class DefaultBindingSQLContext extends AbstractScope implements BindingSQLCon } @Override - public final ConverterScope converterScope() { - return render.converterScope(); + public final ConverterContext converterContext() { + return render.converterContext(); } @Override @@ -90,7 +90,7 @@ class DefaultBindingSQLContext extends AbstractScope implements BindingSQLCon @Override public BindingSQLContext convert(Converter converter) { - return new DefaultBindingSQLContext<>(configuration, data, render, scoped(converter).to(value, converterScope()), variable); + return new DefaultBindingSQLContext<>(configuration, data, render, scoped(converter).to(value, converterContext()), variable); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetSQLOutputContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetSQLOutputContext.java index 98906c2f9c..ec667d697f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetSQLOutputContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetSQLOutputContext.java @@ -72,7 +72,7 @@ class DefaultBindingSetSQLOutputContext extends AbstractExecuteScope implemen @Override public final BindingSetSQLOutputContext convert(Converter converter) { - return new DefaultBindingSetSQLOutputContext<>(ctx, output, scoped(converter).to(value, converterScope())); + return new DefaultBindingSetSQLOutputContext<>(ctx, output, scoped(converter).to(value, converterContext())); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetStatementContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetStatementContext.java index 061ac8357e..665877f203 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetStatementContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingSetStatementContext.java @@ -79,7 +79,7 @@ class DefaultBindingSetStatementContext extends AbstractExecuteScope implemen @Override public final BindingSetStatementContext convert(Converter converter) { - return new DefaultBindingSetStatementContext<>(ctx, statement, index, scoped(converter).to(value, converterScope())); + return new DefaultBindingSetStatementContext<>(ctx, statement, index, scoped(converter).to(value, converterContext())); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultConverterScope.java b/jOOQ/src/main/java/org/jooq/impl/DefaultConverterContext.java similarity index 81% rename from jOOQ/src/main/java/org/jooq/impl/DefaultConverterScope.java rename to jOOQ/src/main/java/org/jooq/impl/DefaultConverterContext.java index 157a5c7b1b..9c07a32098 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultConverterScope.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultConverterContext.java @@ -40,18 +40,18 @@ package org.jooq.impl; import java.util.Map; import org.jooq.Configuration; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; /** * @author Lukas Eder */ -final class DefaultConverterScope extends AbstractScope implements ConverterScope { +final class DefaultConverterContext extends AbstractScope implements ConverterContext { - DefaultConverterScope(Configuration configuration) { + DefaultConverterContext(Configuration configuration) { super(configuration, new DataMap()); } - DefaultConverterScope(Configuration configuration, Map data) { + DefaultConverterContext(Configuration configuration, Map data) { super(configuration, data); } } diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultExecuteContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultExecuteContext.java index 7152b88d8e..0890b0d6a3 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultExecuteContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultExecuteContext.java @@ -61,7 +61,7 @@ import java.util.Map; import org.jooq.Configuration; import org.jooq.ConnectionProvider; import org.jooq.Constants; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.DDLQuery; import org.jooq.DSLContext; import org.jooq.Delete; @@ -95,7 +95,7 @@ class DefaultExecuteContext implements ExecuteContext { private static final JooqLogger log = JooqLogger.getLogger(DefaultExecuteContext.class); // Persistent attributes (repeatable) - private final ConverterScope converterScope; + private final ConverterContext converterContext; private final Instant creationTime; private final Configuration originalConfiguration; private final Configuration derivedConfiguration; @@ -337,7 +337,7 @@ class DefaultExecuteContext implements ExecuteContext { this.data = new DataMap(); this.query = query; this.routine = routine; - this.converterScope = new DefaultConverterScope(derivedConfiguration, data); + this.converterContext = new DefaultConverterContext(derivedConfiguration, data); if (routine != null) { this.batch = false; @@ -370,8 +370,8 @@ class DefaultExecuteContext implements ExecuteContext { } @Override - public final ConverterScope converterScope() { - return converterScope; + public final ConverterContext converterContext() { + return converterContext; } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/DelegatingConverter.java b/jOOQ/src/main/java/org/jooq/impl/DelegatingConverter.java index 1f35540467..c854202d76 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DelegatingConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/DelegatingConverter.java @@ -37,7 +37,7 @@ */ package org.jooq.impl; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.ScopedConverter; /** @@ -54,7 +54,7 @@ public class DelegatingConverter extends AbstractScopedConverter { } @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { return delegate.from(t, scope); } @@ -64,7 +64,7 @@ public class DelegatingConverter extends AbstractScopedConverter { } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { return delegate.to(u, scope); } diff --git a/jOOQ/src/main/java/org/jooq/impl/EnumConverter.java b/jOOQ/src/main/java/org/jooq/impl/EnumConverter.java index 19648a05e3..79009b1ba6 100644 --- a/jOOQ/src/main/java/org/jooq/impl/EnumConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/EnumConverter.java @@ -38,14 +38,14 @@ package org.jooq.impl; import static org.jooq.impl.Convert.convert; -import static org.jooq.impl.Internal.converterScope; +import static org.jooq.impl.Internal.converterContext; import static org.jooq.tools.reflect.Reflect.wrapper; import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Function; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; /** * A base class for enum conversion. diff --git a/jOOQ/src/main/java/org/jooq/impl/IdentityConverter.java b/jOOQ/src/main/java/org/jooq/impl/IdentityConverter.java index b08a75e5db..d23eb20396 100644 --- a/jOOQ/src/main/java/org/jooq/impl/IdentityConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/IdentityConverter.java @@ -38,7 +38,7 @@ package org.jooq.impl; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.ScopedConverter; /** @@ -54,12 +54,12 @@ public final class IdentityConverter implements ScopedConverter { } @Override - public final T from(T t, ConverterScope scope) { + public final T from(T t, ConverterContext scope) { return t; } @Override - public final T to(T t, ConverterScope scope) { + public final T to(T t, ConverterContext scope) { return t; } diff --git a/jOOQ/src/main/java/org/jooq/impl/Internal.java b/jOOQ/src/main/java/org/jooq/impl/Internal.java index d099afc465..385606b9e9 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Internal.java +++ b/jOOQ/src/main/java/org/jooq/impl/Internal.java @@ -53,7 +53,7 @@ import org.jooq.Binding; import org.jooq.Check; import org.jooq.Comment; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.DDLExportConfiguration; import org.jooq.DataType; import org.jooq.Domain; @@ -630,9 +630,9 @@ public final class Internal { return 0x7FFFFFF & object.hashCode(); } - private static final ConverterScope CONVERTER_SCOPE = new DefaultConverterScope(CONFIG); + private static final ConverterContext CONVERTER_SCOPE = new DefaultConverterContext(CONFIG); - public static final ConverterScope converterScope() { + public static final ConverterContext converterContext() { return CONVERTER_SCOPE; } } diff --git a/jOOQ/src/main/java/org/jooq/impl/JPAConverter.java b/jOOQ/src/main/java/org/jooq/impl/JPAConverter.java index fe245f6907..7b13f7a1a9 100644 --- a/jOOQ/src/main/java/org/jooq/impl/JPAConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/JPAConverter.java @@ -41,7 +41,7 @@ import java.lang.reflect.Method; import jakarta.persistence.AttributeConverter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.exception.MappingException; import org.jooq.tools.JooqLogger; import org.jooq.tools.reflect.Reflect; @@ -117,12 +117,12 @@ public final class JPAConverter extends AbstractScopedConverter { } @Override - public final U from(T t, ConverterScope scope) { + public final U from(T t, ConverterContext scope) { return delegate.convertToEntityAttribute(t); } @Override - public final T to(U u, ConverterScope scope) { + public final T to(U u, ConverterContext scope) { return delegate.convertToDatabaseColumn(u); } } diff --git a/jOOQ/src/main/java/org/jooq/impl/LegacyConvertedDataType.java b/jOOQ/src/main/java/org/jooq/impl/LegacyConvertedDataType.java index 83ff7c481e..0efa3fcd9f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/LegacyConvertedDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/LegacyConvertedDataType.java @@ -37,7 +37,7 @@ */ package org.jooq.impl; -import static org.jooq.impl.Internal.converterScope; +import static org.jooq.impl.Internal.converterContext; import org.jooq.Binding; import org.jooq.Configuration; @@ -99,7 +99,7 @@ final class LegacyConvertedDataType extends DefaultDataType { // [#3200] Try to convert arbitrary objects to T else - return ((ScopedConverter) getConverter()).from(delegate.convert(object), converterScope()); + return ((ScopedConverter) getConverter()).from(delegate.convert(object), converterContext()); } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/jOOQ/src/main/java/org/jooq/impl/R2DBC.java b/jOOQ/src/main/java/org/jooq/impl/R2DBC.java index cd6ae0700d..91c92e9155 100644 --- a/jOOQ/src/main/java/org/jooq/impl/R2DBC.java +++ b/jOOQ/src/main/java/org/jooq/impl/R2DBC.java @@ -44,7 +44,7 @@ import static org.jooq.impl.Internal.subscriber; import static org.jooq.impl.Tools.EMPTY_PARAM; import static org.jooq.impl.Tools.abstractDMLQuery; import static org.jooq.impl.Tools.abstractResultQuery; -import static org.jooq.impl.Tools.converterScope; +import static org.jooq.impl.Tools.converterContext; import static org.jooq.impl.Tools.fields; import static org.jooq.impl.Tools.recordFactory; import static org.jooq.impl.Tools.translate; @@ -1240,7 +1240,7 @@ final class R2DBC { if (converter == null) throw new DataTypeException("Cannot convert from " + o.getClass() + " to " + uType + ". Please report an issue here: https://github.com/jOOQ/jOOQ/issues/new. As a workaround, you can implement a ConverterProvider."); else - return scoped(converter).from(o, converterScope(c)); + return scoped(converter).from(o, converterContext(c)); } // --------------------------------------------------------------------- diff --git a/jOOQ/src/main/java/org/jooq/impl/SimpleExecuteContext.java b/jOOQ/src/main/java/org/jooq/impl/SimpleExecuteContext.java index b556a3d7ea..bc4760907b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SimpleExecuteContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/SimpleExecuteContext.java @@ -46,7 +46,7 @@ import java.util.Map; import org.jooq.Configuration; import org.jooq.ConnectionProvider; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; import org.jooq.ExecuteContext; import org.jooq.ExecuteType; import org.jooq.Query; @@ -68,8 +68,8 @@ final class SimpleExecuteContext extends AbstractScope implements ExecuteContext } @Override - public final ConverterScope converterScope() { - return Tools.converterScope(configuration); + public final ConverterContext converterContext() { + return Tools.converterContext(configuration); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/TimeToLocalTimeConverter.java b/jOOQ/src/main/java/org/jooq/impl/TimeToLocalTimeConverter.java index 9c4c096733..b51be38b3f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/TimeToLocalTimeConverter.java +++ b/jOOQ/src/main/java/org/jooq/impl/TimeToLocalTimeConverter.java @@ -42,7 +42,7 @@ import java.time.LocalTime; import java.util.function.Function; import org.jooq.Converter; -import org.jooq.ConverterScope; +import org.jooq.ConverterContext; /** * @author Lukas Eder @@ -59,12 +59,12 @@ public final class TimeToLocalTimeConverter extends AbstractScopedConverter