[#8036] Add DataType.isTime()
This commit is contained in:
parent
514633b435
commit
31fd89753c
@ -461,18 +461,27 @@ public interface DataType<T> extends Serializable {
|
||||
boolean isDateTime();
|
||||
|
||||
/**
|
||||
* Whether this data type is any date or time type.
|
||||
* Whether this data type is any date type.
|
||||
* <p>
|
||||
* This applies to any of these types.
|
||||
* <ul>
|
||||
* <li> {@link SQLDataType#DATE}</li>
|
||||
* <li> {@link SQLDataType#LOCALDATE}</li>
|
||||
* <li>{@link SQLDataType#DATE}</li>
|
||||
* <li>{@link SQLDataType#LOCALDATE}</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* This is a combination of {@link #isDateTime()} or {@link #isInterval()}
|
||||
*/
|
||||
boolean isDate();
|
||||
|
||||
/**
|
||||
* Whether this data type is any time type.
|
||||
* <p>
|
||||
* This applies to any of these types.
|
||||
* <ul>
|
||||
* <li>{@link SQLDataType#TIME}</li>
|
||||
* <li>{@link SQLDataType#LOCALTIME}</li>
|
||||
* </ul>
|
||||
*/
|
||||
boolean isTime();
|
||||
|
||||
/**
|
||||
* Whether this data type is any date or time type.
|
||||
* <p>
|
||||
|
||||
@ -919,6 +919,15 @@ public class DefaultDataType<T> implements DataType<T> {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isTime() {
|
||||
return java.sql.Time.class.isAssignableFrom(tType)
|
||||
|
||||
|| java.time.LocalTime.class.isAssignableFrom(tType)
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isTemporal() {
|
||||
return isDateTime() || isInterval();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user