[jOOQ/jOOQ#10936] Add DataType.null_() and notNull() as synonyms for nullable(boolean)

This commit is contained in:
Lukas Eder 2020-11-13 12:29:27 +01:00
parent 574370f1ee
commit c06bbc4008
2 changed files with 26 additions and 0 deletions

View File

@ -326,6 +326,22 @@ public interface DataType<T> extends Named {
*/
boolean nullable();
/**
* Synonym for {@link #nullable(boolean)}, passing <code>true</code> as an
* argument.
*/
@NotNull
@Support
DataType<T> null_();
/**
* Synonym for {@link #nullable(boolean)}, passing <code>false</code> as an
* argument.
*/
@NotNull
@Support
DataType<T> notNull();
/**
* Return a new data type like this, with a new collation.
*/

View File

@ -137,6 +137,16 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
return nullability().nullable();
}
@Override
public final DataType<T> null_() {
return nullable(true);
}
@Override
public DataType<T> notNull() {
return nullable(false);
}
@Override
public final DataType<T> collation(Collation c) {
return construct(precision0(), scale0(), length0(), nullability(), c, characterSet(), identity(), defaultValue());