[#2441] Add DSL.cast(Field<?>, XXX) for increased API consistency
This commit is contained in:
parent
de3458f0d5
commit
ce52beb115
@ -3492,6 +3492,19 @@ public class DSL {
|
||||
return Utils.field(value, as).cast(as);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a field to the type of another field.
|
||||
*
|
||||
* @param <T> The generic type of the cast field
|
||||
* @param field The field to cast
|
||||
* @param as The field whose type is used for the cast
|
||||
* @return The cast field
|
||||
*/
|
||||
@Support
|
||||
public static <T> Field<T> cast(Field<?> field, Field<T> as) {
|
||||
return nullSafe(field).cast(as);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast null to the type of another field.
|
||||
*
|
||||
@ -3517,6 +3530,19 @@ public class DSL {
|
||||
return Utils.field(value, type).cast(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a field to another type.
|
||||
*
|
||||
* @param <T> The generic type of the cast field
|
||||
* @param field The field to cast
|
||||
* @param type The type that is used for the cast
|
||||
* @return The cast field
|
||||
*/
|
||||
@Support
|
||||
public static <T> Field<T> cast(Field<?> field, Class<T> type) {
|
||||
return nullSafe(field).cast(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast null to a type.
|
||||
*
|
||||
@ -3542,6 +3568,19 @@ public class DSL {
|
||||
return Utils.field(value, type).cast(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a field to another type.
|
||||
*
|
||||
* @param <T> The generic type of the cast field
|
||||
* @param field The value to cast
|
||||
* @param type The type that is used for the cast
|
||||
* @return The cast field
|
||||
*/
|
||||
@Support
|
||||
public static <T> Field<T> cast(Field<?> field, DataType<T> type) {
|
||||
return nullSafe(field).cast(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast null to a type.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user