Change signature of Field.shl() and Field.shr()

This commit is contained in:
kxbmap 2015-07-22 21:22:30 +09:00
parent bf6c3c4b45
commit 2f1c46a655
3 changed files with 18 additions and 12 deletions

View File

@ -856,7 +856,7 @@ public interface Field<T> extends SelectField<T>, GroupField {
* @see DSL#power(Field, Number)
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
Field<T> shl(T value);
Field<T> shl(Number value);
/**
* The bitwise left shift operator.
@ -865,7 +865,7 @@ public interface Field<T> extends SelectField<T>, GroupField {
* @see DSL#power(Field, Number)
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
Field<T> shl(Field<T> value);
Field<T> shl(Field<? extends Number> value);
/**
* The bitwise right shift operator.
@ -874,7 +874,7 @@ public interface Field<T> extends SelectField<T>, GroupField {
* @see DSL#power(Field, Number)
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
Field<T> shr(T value);
Field<T> shr(Number value);
/**
* The bitwise right shift operator.
@ -883,7 +883,7 @@ public interface Field<T> extends SelectField<T>, GroupField {
* @see DSL#power(Field, Number)
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
Field<T> shr(Field<T> value);
Field<T> shr(Field<? extends Number> value);
// ------------------------------------------------------------------------
// NULL predicates

View File

@ -542,26 +542,26 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> shl(T value) {
return DSL.shl((Field) this, (Field) val(value, this));
public final Field<T> shl(Number value) {
return DSL.shl((Field) this, (Field) Utils.field(value));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> shl(Field<T> value) {
return DSL.shl((Field) this, (Field) value);
public final Field<T> shl(Field<? extends Number> value) {
return DSL.shl((Field) this, value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> shr(T value) {
return DSL.shr((Field) this, (Field) val(value, this));
public final Field<T> shr(Number value) {
return DSL.shr((Field) this, (Field) Utils.field(value));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> shr(Field<T> value) {
return DSL.shr((Field) this, (Field) value);
public final Field<T> shr(Field<? extends Number> value) {
return DSL.shr((Field) this, value);
}
// ------------------------------------------------------------------------

View File

@ -159,6 +159,12 @@ public class BasicTest extends AbstractTest {
assertEquals(
FIELD_ID1.sub((Integer) null),
FIELD_ID1.sub((Field<Integer>) null));
assertEquals(
FIELD_ID1.shl((Long) null),
FIELD_ID1.shl((Field<Long>) null));
assertEquals(
FIELD_ID1.shr((Long) null),
FIELD_ID1.shr((Field<Long>) null));
// Standalone functions created from the factory
// ---------------------------------------------