[#3703] Deprecate CastMode.SOME and RenderContext.cast()
This commit is contained in:
parent
d70cee4dad
commit
348447248f
@ -472,11 +472,17 @@ public interface Context<C extends Context<C>> {
|
||||
* <td><code>null</code></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @deprecated - [#3703] - 3.5.0 - Do not use this any longer
|
||||
*/
|
||||
@Deprecated
|
||||
Boolean cast();
|
||||
|
||||
/**
|
||||
* Set the new cast mode to {@link CastMode#SOME} for a list of dialects.
|
||||
*
|
||||
* @deprecated - [#3703] - 3.5.0 - Do not use this any longer
|
||||
*/
|
||||
@Deprecated
|
||||
C castModeSome(SQLDialect... dialects);
|
||||
}
|
||||
|
||||
@ -340,13 +340,19 @@ public interface RenderContext extends Context<RenderContext> {
|
||||
* <td><code>null</code></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @deprecated - [#3703] - 3.5.0 - Do not use this any longer
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
Boolean cast();
|
||||
|
||||
/**
|
||||
* Set the new cast mode to {@link CastMode#SOME} for a list of dialects.
|
||||
*
|
||||
* @deprecated - [#3703] - 3.5.0 - Do not use this any longer
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
RenderContext castModeSome(SQLDialect... dialects);
|
||||
|
||||
@ -371,7 +377,10 @@ public interface RenderContext extends Context<RenderContext> {
|
||||
* Cast bind values only in some dialects. The specified dialects assume
|
||||
* {@link #ALWAYS} behaviour, all the other dialects assume
|
||||
* {@link #NEVER}.
|
||||
*
|
||||
* @deprecated - [#3703] - 3.5.0 - Do not use this any longer
|
||||
*/
|
||||
@Deprecated
|
||||
SOME,
|
||||
|
||||
/**
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.jooq.conf.ParamType.INDEXED;
|
||||
import static org.jooq.impl.Utils.DATA_OMIT_CLAUSE_EVENT_EMISSION;
|
||||
|
||||
@ -93,7 +92,6 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
|
||||
ParamType paramType = ParamType.INDEXED;
|
||||
boolean qualify = true;
|
||||
CastMode castMode = CastMode.DEFAULT;
|
||||
SQLDialect[] castDialects;
|
||||
|
||||
AbstractContext(Configuration configuration, PreparedStatement stmt) {
|
||||
this.configuration = configuration;
|
||||
@ -498,28 +496,25 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
|
||||
@Override
|
||||
public final C castMode(CastMode mode) {
|
||||
this.castMode = mode;
|
||||
this.castDialects = null;
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final Boolean cast() {
|
||||
switch (castMode) {
|
||||
case ALWAYS:
|
||||
return true;
|
||||
case NEVER:
|
||||
return false;
|
||||
case SOME:
|
||||
return asList(castDialects).contains(configuration.dialect());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final C castModeSome(SQLDialect... dialects) {
|
||||
this.castMode = CastMode.SOME;
|
||||
this.castDialects = dialects;
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
|
||||
@ -125,23 +125,6 @@ class Val<T> extends AbstractParam<T> {
|
||||
case ALWAYS:
|
||||
toSQLCast(context);
|
||||
return;
|
||||
|
||||
case SOME:
|
||||
|
||||
// This dialect must cast
|
||||
if (context.cast()) {
|
||||
toSQLCast(context);
|
||||
}
|
||||
|
||||
// In some cases, we should still cast
|
||||
else if (shouldCast(context)) {
|
||||
toSQLCast(context);
|
||||
}
|
||||
else {
|
||||
toSQL(context, value, getConverter());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// See if we "should" cast, to stay on the safe side
|
||||
|
||||
Loading…
Reference in New Issue
Block a user