[jOOQ/jOOQ#12911] QOM type accessors should accept Collection when they return UnmodifiableList

This includes:

- [jOOQ/jOOQ#12912] Add missing Select.(), (), setter accessors
This commit is contained in:
Lukas Eder 2022-01-21 14:32:56 +01:00
parent 305c4eccc9
commit 40f47ee06b
12 changed files with 119 additions and 80 deletions

View File

@ -65,6 +65,7 @@ import static org.jooq.SQLDialect.SQLITE;
// ...
import static org.jooq.SQLDialect.YUGABYTEDB;
import java.util.Collection;
import java.util.List;
import org.jooq.impl.DSL;
@ -186,30 +187,33 @@ public interface Select<R extends Record> extends ResultQuery<R>, TableLike<R>,
@Nullable With $with();
@NotNull UnmodifiableList<? extends SelectFieldOrAsterisk> $select();
@NotNull Select<?> $select(UnmodifiableList<? extends SelectFieldOrAsterisk> select);
@NotNull Select<?> $select(Collection<? extends SelectFieldOrAsterisk> newSelect);
boolean $distinct();
@NotNull Select<R> $distinct(boolean distinct);
@NotNull Select<R> $distinct(boolean newDistinct);
@NotNull UnmodifiableList<? extends Table<?>> $from();
@NotNull Select<R> $from(UnmodifiableList<? extends Table<?>> from);
@NotNull Select<R> $from(Collection<? extends Table<?>> newFrom);
@Nullable Condition $where();
@NotNull Select<R> $where(Condition condition);
@NotNull Select<R> $where(Condition newWhere);
@NotNull UnmodifiableList<? extends GroupField> $groupBy();
@NotNull Select<R> $groupBy(Collection<? extends GroupField> newGroupBy);
boolean $groupByDistinct();
@NotNull Select<R> $groupByDistinct(boolean groupByDistinct);
@NotNull Select<R> $groupByDistinct(boolean newGroupByDistinct);
@Nullable Condition $having();
@NotNull Select<R> $having(Condition condition);
@NotNull Select<R> $having(Condition newHaving);
@NotNull UnmodifiableList<? extends WindowDefinition> $window();
@NotNull Select<R> $window(Collection<? extends WindowDefinition> newWindow);
@Nullable Condition $qualify();
@NotNull Select<R> $qualify(Condition condition);
@NotNull Select<R> $qualify(Condition newQualify);
@NotNull UnmodifiableList<? extends SortField<?>> $orderBy();
@NotNull Select<R> $orderBy(Collection<? extends SortField<?>> newOrderBy);
@Nullable Field<? extends Number> $limit();
@NotNull Select<R> $limit(Field<? extends Number> limit);
@NotNull Select<R> $limit(Field<? extends Number> newLimit);
boolean $limitPercent();
@NotNull Select<R> $limitPercent(boolean limitPercent);
@NotNull Select<R> $limitPercent(boolean newLimitPercent);
boolean $limitWithTies();
@NotNull Select<R> $limitWithTies(boolean limitWithTies);
@NotNull Select<R> $limitWithTies(boolean newLimitWithTies);
@Nullable Field<? extends Number> $offset();
@NotNull Select<R> $offset(Field<? extends Number> offset);
@NotNull Select<R> $offset(Field<? extends Number> newOffset);

View File

@ -252,11 +252,11 @@ implements
}
@Override
public final QOM.CreateDomain<T> $constraints(UnmodifiableList<? extends Constraint> newValue) {
public final QOM.CreateDomain<T> $constraints(Collection<? extends Constraint> newValue) {
return $constructor().apply($domain(), $ifNotExists(), $dataType(), $default_(), newValue);
}
public final Function5<? super Domain<?>, ? super Boolean, ? super DataType<T>, ? super Field<T>, ? super UnmodifiableList<? extends Constraint>, ? extends QOM.CreateDomain<T>> $constructor() {
public final Function5<? super Domain<?>, ? super Boolean, ? super DataType<T>, ? super Field<T>, ? super Collection<? extends Constraint>, ? extends QOM.CreateDomain<T>> $constructor() {
return (a1, a2, a3, a4, a5) -> new CreateDomainImpl(configuration(), a1, a2, a3, a4, (Collection<? extends Constraint>) a5);
}

View File

@ -438,12 +438,12 @@ implements
}
@Override
public final QOM.CreateIndex $on(UnmodifiableList<? extends OrderField<?>> newValue) {
public final QOM.CreateIndex $on(Collection<? extends OrderField<?>> newValue) {
return $constructor().apply($unique(), $index(), $ifNotExists(), $table(), newValue, $include(), $where(), $excludeNullKeys());
}
@Override
public final QOM.CreateIndex $include(UnmodifiableList<? extends Field<?>> newValue) {
public final QOM.CreateIndex $include(Collection<? extends Field<?>> newValue) {
return $constructor().apply($unique(), $index(), $ifNotExists(), $table(), $on(), newValue, $where(), $excludeNullKeys());
}
@ -457,7 +457,7 @@ implements
return $constructor().apply($unique(), $index(), $ifNotExists(), $table(), $on(), $include(), $where(), newValue);
}
public final Function8<? super Boolean, ? super Index, ? super Boolean, ? super Table<?>, ? super UnmodifiableList<? extends OrderField<?>>, ? super UnmodifiableList<? extends Field<?>>, ? super Condition, ? super Boolean, ? extends QOM.CreateIndex> $constructor() {
public final Function8<? super Boolean, ? super Index, ? super Boolean, ? super Table<?>, ? super Collection<? extends OrderField<?>>, ? super Collection<? extends Field<?>>, ? super Condition, ? super Boolean, ? extends QOM.CreateIndex> $constructor() {
return (a1, a2, a3, a4, a5, a6, a7, a8) -> new CreateIndexImpl(configuration(), a1, a2, a3, a4, (Collection<? extends OrderField<?>>) a5, (Collection<? extends Field<?>>) a6, a7, a8);
}

View File

@ -226,7 +226,7 @@ implements
}
@Override
public final QOM.Grant $privileges(UnmodifiableList<? extends Privilege> newValue) {
public final QOM.Grant $privileges(Collection<? extends Privilege> newValue) {
return $constructor().apply(newValue, $on(), $to(), $toPublic(), $withGrantOption());
}
@ -250,7 +250,7 @@ implements
return $constructor().apply($privileges(), $on(), $to(), $toPublic(), newValue);
}
public final Function5<? super UnmodifiableList<? extends Privilege>, ? super Table<?>, ? super Role, ? super Boolean, ? super Boolean, ? extends QOM.Grant> $constructor() {
public final Function5<? super Collection<? extends Privilege>, ? super Table<?>, ? super Role, ? super Boolean, ? super Boolean, ? extends QOM.Grant> $constructor() {
return (a1, a2, a3, a4, a5) -> new GrantImpl(configuration(), (Collection<? extends Privilege>) a1, a2, a3, a4, a5);
}

View File

@ -252,7 +252,7 @@ implements
}
@Override
public final QOM.JSONArray<T> $fields(UnmodifiableList<? extends Field<?>> newValue) {
public final QOM.JSONArray<T> $fields(Collection<? extends Field<?>> newValue) {
return $constructor().apply($type(), newValue, $onNull(), $returning());
}
@ -266,7 +266,7 @@ implements
return $constructor().apply($type(), $fields(), $onNull(), newValue);
}
public final Function4<? super DataType<T>, ? super UnmodifiableList<? extends Field<?>>, ? super JSONOnNull, ? super DataType<?>, ? extends QOM.JSONArray<T>> $constructor() {
public final Function4<? super DataType<T>, ? super Collection<? extends Field<?>>, ? super JSONOnNull, ? super DataType<?>, ? extends QOM.JSONArray<T>> $constructor() {
return (a1, a2, a3, a4) -> new JSONArray(a1, (Collection<? extends Field<?>>) a2, a3, a4);
}

View File

@ -284,7 +284,7 @@ implements
}
@Override
public final QOM.JSONObject<T> $entries(UnmodifiableList<? extends JSONEntry<?>> newValue) {
public final QOM.JSONObject<T> $entries(Collection<? extends JSONEntry<?>> newValue) {
return $constructor().apply($type(), newValue, $onNull(), $returning());
}
@ -298,7 +298,7 @@ implements
return $constructor().apply($type(), $entries(), $onNull(), newValue);
}
public final Function4<? super DataType<T>, ? super UnmodifiableList<? extends JSONEntry<?>>, ? super JSONOnNull, ? super DataType<?>, ? extends QOM.JSONObject<T>> $constructor() {
public final Function4<? super DataType<T>, ? super Collection<? extends JSONEntry<?>>, ? super JSONOnNull, ? super DataType<?>, ? extends QOM.JSONObject<T>> $constructor() {
return (a1, a2, a3, a4) -> new JSONObject(a1, (Collection<? extends JSONEntry<?>>) a2, a3, a4);
}

View File

@ -526,16 +526,16 @@ public final class QOM {
// XXX: SelectFields, GroupFields and SortFields
// -------------------------------------------------------------------------
public /* sealed */ interface EmptyGroupingSet
// Can't seal these types yet because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=577872
public /* non-sealed */ interface EmptyGroupingSet
extends
GroupField,
UEmpty
/* permits
org.jooq.impl.EmptyGroupingSet */
/*permits
org.jooq.impl.EmptyGroupingSet*/
{}
// Can't seal these types yet because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=577872
public /* non-sealed */ interface Rollup
extends
GroupField,
@ -1252,7 +1252,7 @@ public final class QOM {
@NotNull CreateDomain<T> $ifNotExists(boolean ifNotExists);
@NotNull CreateDomain<T> $dataType(DataType<T> dataType);
@NotNull CreateDomain<T> $default_(Field<T> default_);
@NotNull CreateDomain<T> $constraints(UnmodifiableList<? extends Constraint> constraints);
@NotNull CreateDomain<T> $constraints(Collection<? extends Constraint> constraints);
}
@ -1308,8 +1308,8 @@ public final class QOM {
@NotNull CreateIndex $index(Index index);
@NotNull CreateIndex $ifNotExists(boolean ifNotExists);
@NotNull CreateIndex $table(Table<?> table);
@NotNull CreateIndex $on(UnmodifiableList<? extends OrderField<?>> on);
@NotNull CreateIndex $include(UnmodifiableList<? extends Field<?>> include);
@NotNull CreateIndex $on(Collection<? extends OrderField<?>> on);
@NotNull CreateIndex $include(Collection<? extends Field<?>> include);
@NotNull CreateIndex $where(Condition where);
@NotNull CreateIndex $excludeNullKeys(boolean excludeNullKeys);
}
@ -1615,7 +1615,7 @@ public final class QOM {
@Nullable Role $to();
boolean $toPublic();
boolean $withGrantOption();
@NotNull Grant $privileges(UnmodifiableList<? extends Privilege> privileges);
@NotNull Grant $privileges(Collection<? extends Privilege> privileges);
@NotNull Grant $on(Table<?> on);
@NotNull Grant $to(Role to);
@NotNull Grant $toPublic(boolean toPublic);
@ -1636,7 +1636,7 @@ public final class QOM {
@NotNull Table<?> $on();
@Nullable Role $from();
boolean $fromPublic();
@NotNull Revoke $privileges(UnmodifiableList<? extends Privilege> privileges);
@NotNull Revoke $privileges(Collection<? extends Privilege> privileges);
@NotNull Revoke $grantOptionFor(boolean grantOptionFor);
@NotNull Revoke $on(Table<?> on);
@NotNull Revoke $from(Role from);
@ -4274,7 +4274,7 @@ public final class QOM {
// XMLConcat
{
@NotNull UnmodifiableList<? extends Field<?>> $args();
@NotNull XMLConcat $args(UnmodifiableList<? extends Field<?>> args);
@NotNull XMLConcat $args(Collection<? extends Field<?>> args);
}
@ -4303,7 +4303,7 @@ public final class QOM {
// XMLForest
{
@NotNull UnmodifiableList<? extends Field<?>> $fields();
@NotNull XMLForest $fields(UnmodifiableList<? extends Field<?>> fields);
@NotNull XMLForest $fields(Collection<? extends Field<?>> fields);
}
/**
@ -4352,7 +4352,7 @@ public final class QOM {
@Nullable JSONOnNull $onNull();
@Nullable DataType<?> $returning();
@NotNull JSONArray<T> $type(DataType<T> type);
@NotNull JSONArray<T> $fields(UnmodifiableList<? extends Field<?>> fields);
@NotNull JSONArray<T> $fields(Collection<? extends Field<?>> fields);
@NotNull JSONArray<T> $onNull(JSONOnNull onNull);
@NotNull JSONArray<T> $returning(DataType<?> returning);
}
@ -4371,7 +4371,7 @@ public final class QOM {
@Nullable JSONOnNull $onNull();
@Nullable DataType<?> $returning();
@NotNull JSONObject<T> $type(DataType<T> type);
@NotNull JSONObject<T> $entries(UnmodifiableList<? extends JSONEntry<?>> entries);
@NotNull JSONObject<T> $entries(Collection<? extends JSONEntry<?>> entries);
@NotNull JSONObject<T> $onNull(JSONOnNull onNull);
@NotNull JSONObject<T> $returning(DataType<?> returning);
}

View File

@ -224,7 +224,7 @@ implements
}
@Override
public final QOM.Revoke $privileges(UnmodifiableList<? extends Privilege> newValue) {
public final QOM.Revoke $privileges(Collection<? extends Privilege> newValue) {
return $constructor().apply(newValue, $grantOptionFor(), $on(), $from(), $fromPublic());
}
@ -248,7 +248,7 @@ implements
return $constructor().apply($privileges(), $grantOptionFor(), $on(), $from(), newValue);
}
public final Function5<? super UnmodifiableList<? extends Privilege>, ? super Boolean, ? super Table<?>, ? super Role, ? super Boolean, ? extends QOM.Revoke> $constructor() {
public final Function5<? super Collection<? extends Privilege>, ? super Boolean, ? super Table<?>, ? super Role, ? super Boolean, ? extends QOM.Revoke> $constructor() {
return (a1, a2, a3, a4, a5) -> new RevokeImpl(configuration(), (Collection<? extends Privilege>) a1, a2, a3, a4, a5);
}

View File

@ -135,6 +135,8 @@ import org.jooq.WindowDefinition;
import org.jooq.impl.QOM.UnmodifiableList;
import org.jooq.impl.QOM.With;
import org.jetbrains.annotations.NotNull;
/**
* A wrapper for a {@link SelectQuery}
*
@ -3355,8 +3357,8 @@ implements
}
@Override
public final Select<?> $select(UnmodifiableList<? extends SelectFieldOrAsterisk> select) {
return getDelegate().$select(select);
public final Select<?> $select(Collection<? extends SelectFieldOrAsterisk> newSelect) {
return getDelegate().$select(newSelect);
}
@Override
@ -3365,8 +3367,8 @@ implements
}
@Override
public final Select<R> $distinct(boolean distinct) {
return getDelegate().$distinct(distinct);
public final Select<R> $distinct(boolean newDistinct) {
return getDelegate().$distinct(newDistinct);
}
@Override
@ -3375,8 +3377,8 @@ implements
}
@Override
public final Select<R> $from(UnmodifiableList<? extends Table<?>> from) {
return getDelegate().$from(from);
public final Select<R> $from(Collection<? extends Table<?>> newFrom) {
return getDelegate().$from(newFrom);
}
@Override
@ -3385,8 +3387,8 @@ implements
}
@Override
public final Select<R> $where(Condition condition) {
return getDelegate().$where(condition);
public final Select<R> $where(Condition newWhere) {
return getDelegate().$where(newWhere);
}
@Override
@ -3394,14 +3396,19 @@ implements
return getDelegate().$groupBy();
}
@Override
public final Select<R> $groupBy(Collection<? extends GroupField> newGroupBy) {
return getDelegate().$groupBy(newGroupBy);
}
@Override
public final boolean $groupByDistinct() {
return getDelegate().$groupByDistinct();
}
@Override
public final Select<R> $groupByDistinct(boolean groupByDistinct) {
return getDelegate().$groupByDistinct(groupByDistinct);
public final Select<R> $groupByDistinct(boolean newGroupByDistinct) {
return getDelegate().$groupByDistinct(newGroupByDistinct);
}
@Override
@ -3410,8 +3417,8 @@ implements
}
@Override
public final Select<R> $having(Condition condition) {
return getDelegate().$having(condition);
public final Select<R> $having(Condition newHaving) {
return getDelegate().$having(newHaving);
}
@Override
@ -3419,14 +3426,19 @@ implements
return getDelegate().$window();
}
@Override
public final Select<R> $window(Collection<? extends WindowDefinition> newWindow) {
return getDelegate().$window(newWindow);
}
@Override
public final Condition $qualify() {
return getDelegate().$qualify();
}
@Override
public final Select<R> $qualify(Condition condition) {
return getDelegate().$qualify(condition);
public final Select<R> $qualify(Condition newQualify) {
return getDelegate().$qualify(newQualify);
}
@Override
@ -3434,14 +3446,19 @@ implements
return getDelegate().$orderBy();
}
@Override
public final Select<R> $orderBy(Collection<? extends SortField<?>> newOrderBy) {
return getDelegate().$orderBy(newOrderBy);
}
@Override
public final Field<? extends Number> $limit() {
return getDelegate().$limit();
}
@Override
public final Select<R> $limit(Field<? extends Number> l) {
return getDelegate().$limit(l);
public final Select<R> $limit(Field<? extends Number> newLimit) {
return getDelegate().$limit(newLimit);
}
@Override
@ -3450,8 +3467,8 @@ implements
}
@Override
public final Select<R> $limitPercent(boolean limitPercent) {
return getDelegate().$limitPercent(limitPercent);
public final Select<R> $limitPercent(boolean newLimitPercent) {
return getDelegate().$limitPercent(newLimitPercent);
}
@Override
@ -3460,8 +3477,8 @@ implements
}
@Override
public final Select<R> $limitWithTies(boolean limitWithTies) {
return getDelegate().$limitWithTies(limitWithTies);
public final Select<R> $limitWithTies(boolean newLimitWithTies) {
return getDelegate().$limitWithTies(newLimitWithTies);
}
@Override
@ -3470,8 +3487,8 @@ implements
}
@Override
public final Select<R> $offset(Field<? extends Number> o) {
return getDelegate().$offset(o);
public final Select<R> $offset(Field<? extends Number> newOffset) {
return getDelegate().$offset(newOffset);
}

View File

@ -4454,14 +4454,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
}
@Override
public final SelectQueryImpl<?> $select(UnmodifiableList<? extends SelectFieldOrAsterisk> newSelect) {
if ($select() == newSelect)
return this;
else
return copy(s -> {
s.select.clear();
s.select.addAll(newSelect);
});
public final SelectQueryImpl<?> $select(Collection<? extends SelectFieldOrAsterisk> newSelect) {
return copy(s -> {
s.select.clear();
s.select.addAll(newSelect);
});
}
@Override
@ -4483,14 +4480,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
}
@Override
public final SelectQueryImpl<R> $from(UnmodifiableList<? extends Table<?>> newFrom) {
if ($from() == newFrom)
return this;
else
return copy(s -> {
s.from.clear();
s.from.addAll(newFrom);
});
public final SelectQueryImpl<R> $from(Collection<? extends Table<?>> newFrom) {
return copy(s -> {
s.from.clear();
s.from.addAll(newFrom);
});
}
@Override
@ -4511,6 +4505,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
return QOM.unmodifiable(groupBy == null ? new GroupFieldList() : groupBy);
}
@Override
public final Select<R> $groupBy(Collection<? extends GroupField> newGroupBy) {
return copy(s -> {
s.groupBy.clear();
s.groupBy.addAll(newGroupBy);
});
}
@Override
public final boolean $groupByDistinct() {
return groupByDistinct;
@ -4542,6 +4544,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
return QOM.unmodifiable(window == null ? QueryPartList.emptyList() : window);
}
@Override
public final Select<R> $window(Collection<? extends WindowDefinition> newWindow) {
return copy(s -> {
s.window.clear();
s.window.addAll(newWindow);
});
}
@Override
public final Condition $qualify() {
return qualify;
@ -4560,6 +4570,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
return QOM.unmodifiable(orderBy);
}
@Override
public final Select<R> $orderBy(Collection<? extends SortField<?>> newOrderBy) {
return copy(s -> {
s.orderBy.clear();
s.orderBy.addAll(newOrderBy);
});
}
@Override
public final Field<? extends Number> $limit() {
return getLimit().limit;

View File

@ -128,11 +128,11 @@ implements
}
@Override
public final QOM.XMLForest $fields(UnmodifiableList<? extends Field<?>> newValue) {
public final QOM.XMLForest $fields(Collection<? extends Field<?>> newValue) {
return $constructor().apply(newValue);
}
public final Function1<? super UnmodifiableList<? extends Field<?>>, ? extends QOM.XMLForest> $constructor() {
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.XMLForest> $constructor() {
return (a1) -> new XMLForest((Collection<? extends Field<?>>) a1);
}

View File

@ -126,11 +126,11 @@ implements
}
@Override
public final QOM.XMLConcat $args(UnmodifiableList<? extends Field<?>> newValue) {
public final QOM.XMLConcat $args(Collection<? extends Field<?>> newValue) {
return $constructor().apply(newValue);
}
public final Function1<? super UnmodifiableList<? extends Field<?>>, ? extends QOM.XMLConcat> $constructor() {
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.XMLConcat> $constructor() {
return (a1) -> new XMLConcat((Collection<? extends Field<?>>) a1);
}