[jOOQ/jOOQ#15966] Remove mandatory dependency from compileJava to

jOOQ-codegen-gradle tasks

This includes:

- [jOOQ/jOOQ#15974] Cannot look up tasks.named(jooqCodegen) from
gradle scripts
- [jOOQ/jOOQ#16003] Misleading XSD warnings logged when working with
MiniJAXB
This commit is contained in:
Lukas Eder 2024-01-05 15:16:49 +01:00
parent 476182fdd2
commit 729acdf795
55 changed files with 205 additions and 169 deletions

View File

@ -44,11 +44,14 @@ import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.TaskProvider;
import org.jooq.tools.StringUtils;
import org.jooq.util.jaxb.tools.MiniJAXB;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -66,52 +69,57 @@ public class CodegenPlugin implements Plugin<Project> {
Configuration runtimeClasspath = project.getConfigurations().getByName("runtimeClasspath");
Configuration codegenClasspath = project.getConfigurations().create("jooqCodegen");
codegenClasspath.setDescription("The classpath used for code generation, including JDBC drivers, code generation extensions, etc.");
SourceSetContainer source = project
.getExtensions()
.getByType(SourceSetContainer.class);
project.afterEvaluate(p -> {
boolean unnamed = true;
List<Task> tasks = new ArrayList<>();
jooq.getExecutions().create("", configuration -> {
configuration.unnamed = true;
configuration.configuration = CodegenPluginExtension.copy(jooq.configuration);
});
for (NamedConfiguration configuration : p.getExtensions().getByType(CodegenPluginExtension.class).configurations()) {
unnamed &= configuration.unnamed;
AtomicReference<Task> all = new AtomicReference<>();
CodegenTask task = p.getTasks().create(
"jooqCodegen" + (configuration.unnamed ? "" : StringUtils.toUC(configuration.name)),
CodegenTask.class,
configuration,
runtimeClasspath,
codegenClasspath
);
jooq.getExecutions().configureEach(configuration -> {
configuration.configuration = MiniJAXB.append(
MiniJAXB.append(new org.jooq.meta.jaxb.Configuration(), CodegenPluginExtension.copy(jooq.configuration)),
CodegenPluginExtension.copy(configuration.configuration)
);
task.setDescription("jOOQ code generation" + (configuration.unnamed ? "" : " for " + configuration.name + " execution"));
task.setGroup("jOOQ");
// [#15966] [#15974] TODO: The default, unnamed execution only makes sense in the absence of executions, but how to add it conditionally?
CodegenTask task = project.getTasks().create(
"jooqCodegen" + (configuration.unnamed ? "" : StringUtils.toUC(configuration.name)),
CodegenTask.class,
configuration,
runtimeClasspath,
codegenClasspath
);
Task compileJava = p.getTasks().findByName("compileJava");
if (compileJava != null)
compileJava.dependsOn(task);
task.setDescription("jOOQ code generation" + (configuration.unnamed ? "" : " for the " + configuration.name + " execution"));
task.setGroup("jOOQ");
source.configureEach(sourceSet -> {
if (configuration.unnamed && sourceSet.getName().equals("main") ||
sourceSet.getName().equals(configuration.name)) {
sourceSet.getJava().srcDir(task.getOutputDirectory());
}
});
source.configureEach(sourceSet -> {
if (configuration.unnamed && sourceSet.getName().equals("main") ||
sourceSet.getName().equals(configuration.name)) {
sourceSet.getJava().srcDir(task.getOutputDirectory());
}
});
tasks.add(task);
}
if (!unnamed) {
p.getTasks().create(
"jooqCodegen",
task -> {
task.setDescription("jOOQ code generation for all executions");
task.setGroup("jOOQ");
task.setDependsOn(tasks);
}
);
if (!configuration.unnamed) {
if (all.get() != null) {
all.get().dependsOn(task);
}
else {
all.set(project.getTasks().create("jooqCodegenAll",
t -> {
t.setDescription("jOOQ code generation for all executions");
t.setGroup("jOOQ");
t.dependsOn(task);
}
));
}
}
});
}

View File

@ -38,10 +38,14 @@
package org.jooq.codegen.gradle;
import org.gradle.api.Action;
import org.gradle.api.Named;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project;
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.internal.service.scopes.Scope;
import org.gradle.internal.service.scopes.ServiceScope;
import org.jooq.meta.jaxb.Configuration;
import org.jooq.util.jaxb.tools.MiniJAXB;
import org.jooq.codegen.gradle.MetaExtensions.*;
@ -59,14 +63,15 @@ import groovy.lang.*;
*/
public class CodegenPluginExtension {
final ObjectFactory objects;
final Configuration configuration;
final NamedDomainObjectContainer<NamedConfiguration> executions;
private transient List<NamedConfiguration> configurations;
final ObjectFactory objects;
final Project project;
final Configuration configuration;
final NamedDomainObjectContainer<NamedConfiguration> executions;
@Inject
public CodegenPluginExtension(ObjectFactory objects, ProviderFactory providers, ProjectLayout layout) {
public CodegenPluginExtension(ObjectFactory objects, Project project, ProviderFactory providers, ProjectLayout layout) {
this.objects = objects;
this.project = project;
this.configuration = NamedConfiguration.newConfiguration();
this.executions = objects.domainObjectContainer(NamedConfiguration.class,
name -> objects.newInstance(NamedConfiguration.class, objects, name)
@ -75,6 +80,7 @@ public class CodegenPluginExtension {
void configuration0(Configuration configuration) {
MiniJAXB.append(this.configuration, configuration);
executions.getByName("").configuration0(configuration);
}
public void configuration(Action<ConfigurationExtension> action) {
@ -87,23 +93,7 @@ public class CodegenPluginExtension {
return executions;
}
List<NamedConfiguration> configurations() {
if (configurations == null) {
if (executions.isEmpty())
configurations = Arrays.asList(new NamedConfiguration(objects, "main", true, configuration));
else
configurations = executions.stream().map(c -> new NamedConfiguration(
objects, c.name, false, MiniJAXB.append(
MiniJAXB.append(new Configuration(), copy(configuration)),
copy(c.configuration)
)
)).collect(toList());
}
return configurations;
}
Configuration copy(Configuration configuration) {
static Configuration copy(Configuration configuration) {
return MiniJAXB.unmarshal(MiniJAXB.marshal(configuration), Configuration.class);
}
}

View File

@ -67,6 +67,8 @@ import java.util.List;
public class CodegenTask extends DefaultTask {
private final NamedConfiguration configuration;
private final FileCollection runtimeClasspath;
private final FileCollection codegenClasspath;
private final ProviderFactory providers;
private final List<File> classpath;
private final Directory outputDirectory;
@ -82,7 +84,8 @@ public class CodegenTask extends DefaultTask {
this.configuration = configuration;
this.providers = providers;
this.classpath = new ArrayList<>();
this.classpath.addAll(codegenClasspath.getFiles());
this.runtimeClasspath = runtimeClasspath;
this.codegenClasspath = codegenClasspath;
// [#15944] Override default target directory
Target target = configuration.configuration.getGenerator().getTarget();
@ -127,6 +130,9 @@ public class CodegenTask extends DefaultTask {
@Classpath
public Iterable<File> getClasspath() {
if (classpath.isEmpty())
classpath.addAll(codegenClasspath.getFiles());
return classpath;
}

View File

@ -38,6 +38,7 @@
package org.jooq.codegen.gradle;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.model.ObjectFactory;
import org.jooq.meta.jaxb.Configuration;
import org.jooq.meta.jaxb.Generator;
@ -56,17 +57,19 @@ import org.codehaus.groovy.runtime.*;
public class NamedConfiguration {
final ObjectFactory objects;
final Project project;
final String name;
final boolean unnamed;
final Configuration configuration;
boolean unnamed;
Configuration configuration;
@Inject
public NamedConfiguration(ObjectFactory objects, String name) {
this(objects, name, false, newConfiguration());
public NamedConfiguration(ObjectFactory objects, Project project, String name) {
this(objects, project, name, false, newConfiguration());
}
NamedConfiguration(ObjectFactory objects, String name, boolean unnamed, Configuration configuration) {
NamedConfiguration(ObjectFactory objects, Project project, String name, boolean unnamed, Configuration configuration) {
this.objects = objects;
this.project = project;
this.name = name;
this.unnamed = unnamed;
this.configuration = configuration;
@ -87,6 +90,9 @@ public class NamedConfiguration {
}
void configuration0(Configuration configuration) {
if (!unnamed)
MiniJAXB.append(this.configuration, project.getExtensions().getByType(CodegenPluginExtension.class).configuration);
MiniJAXB.append(this.configuration, configuration);
}

View File

@ -140,7 +140,7 @@ public final class Constants {
/**
* The current jooq-codegen XSD file name.
*/
public static final String XSD_CODEGEN = "jooq-codegen-3.19.0.xsd";
public static final String XSD_CODEGEN = "jooq-codegen-3.19.2.xsd";
/**
* The current jooq-codegen XML namespace.

View File

@ -140,7 +140,7 @@ public final class Constants {
/**
* The current jooq-codegen XSD file name.
*/
public static final String XSD_CODEGEN = "jooq-codegen-3.19.0.xsd";
public static final String XSD_CODEGEN = "jooq-codegen-3.19.2.xsd";
/**
* The current jooq-codegen XML namespace.

View File

@ -32,7 +32,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class CatalogMappingType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true, defaultValue = "")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String inputCatalog = "";

View File

@ -30,7 +30,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class CommentType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;

View File

@ -24,11 +24,11 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="logging" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}Logging" minOccurs="0"/&gt;
* &lt;element name="onError" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}OnError" minOccurs="0"/&gt;
* &lt;element name="onUnused" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}OnError" minOccurs="0"/&gt;
* &lt;element name="jdbc" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}Jdbc" minOccurs="0"/&gt;
* &lt;element name="generator" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}Generator"/&gt;
* &lt;element name="logging" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}Logging" minOccurs="0"/&gt;
* &lt;element name="onError" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}OnError" minOccurs="0"/&gt;
* &lt;element name="onUnused" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}OnError" minOccurs="0"/&gt;
* &lt;element name="jdbc" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}Jdbc" minOccurs="0"/&gt;
* &lt;element name="generator" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}Generator"/&gt;
* &lt;element name="basedir" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
@ -49,7 +49,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Configuration implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlSchemaType(name = "string")
protected Logging logging;
@XmlElement(defaultValue = "FAIL")

View File

@ -30,7 +30,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class CustomType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;

View File

@ -33,7 +33,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Database implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -32,7 +32,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class EmbeddableDefinitionType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String catalog;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -42,7 +42,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class EmbeddableField implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlElement(required = true)

View File

@ -42,7 +42,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class EnumType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;

View File

@ -29,7 +29,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class ForcedType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(defaultValue = "0")
protected Integer priority = 0;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -29,7 +29,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Generate implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(defaultValue = "true")
protected Boolean indexes = true;
@XmlElement(defaultValue = "true")

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Generator implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(defaultValue = "org.jooq.codegen.DefaultGenerator")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name = "org.jooq.codegen.DefaultGenerator";

View File

@ -32,7 +32,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Jdbc implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String driver;
@XmlElement(required = true)

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class LambdaConverter implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String from;

View File

@ -23,7 +23,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;all&gt;
* &lt;element name="transform" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}MatcherTransformType" minOccurs="0"/&gt;
* &lt;element name="transform" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}MatcherTransformType" minOccurs="0"/&gt;
* &lt;element name="expression" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
@ -43,7 +43,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatcherRule implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlSchemaType(name = "string")
protected MatcherTransformType transform;
@XmlElement(required = true)

View File

@ -43,7 +43,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Matchers implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElementWrapper(name = "catalogs")
@XmlElement(name = "catalog")
protected List<MatchersCatalogType> catalogs;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersAttributeType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule attributeIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersCatalogType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule catalogClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersEmbeddableType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule recordClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersEnumType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule enumClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersFieldType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule fieldIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersForeignKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule keyIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersIndexType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule keyIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersPrimaryKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule keyIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersRoutineType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule routineClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersSchemaType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule schemaClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersSequenceType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule sequenceIdentifier;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersTableType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule tableClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersUDTType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule udtClass;

View File

@ -27,7 +27,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class MatchersUniqueKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String expression;
protected MatcherRule keyIdentifier;

View File

@ -29,7 +29,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Property implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String key;

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SchemaMappingType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true, defaultValue = "")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String inputSchema = "";

View File

@ -30,7 +30,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Strategy implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(defaultValue = "org.jooq.codegen.DefaultGeneratorStrategy")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name = "org.jooq.codegen.DefaultGeneratorStrategy";

View File

@ -44,7 +44,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticColumnType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tables;
@XmlElement(required = true)

View File

@ -44,7 +44,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticDaoMethodType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;

View File

@ -30,7 +30,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;element name="schema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="comment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="methods" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticDaoMethodsType" minOccurs="0"/&gt;
* &lt;element name="methods" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticDaoMethodsType" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
@ -49,7 +49,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticDaoType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String catalog;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -29,7 +29,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="fields" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="literals" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticEnumLiteralsType" minOccurs="0"/&gt;
* &lt;element name="literals" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticEnumLiteralsType" minOccurs="0"/&gt;
* &lt;element name="literalSql" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="literalsFromColumnContent" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/&gt;
* &lt;element name="literalsFromCheckConstraints" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/&gt;
@ -52,7 +52,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticEnumType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -28,9 +28,9 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;element name="referencedTable" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="referencedFields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticKeyFieldsType" minOccurs="0"/&gt;
* &lt;element name="referencedFields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticKeyFieldsType" minOccurs="0"/&gt;
* &lt;element name="referencedKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
@ -50,7 +50,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticForeignKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -42,7 +42,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticIdentityType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tables;
@XmlElement(required = true)

View File

@ -30,7 +30,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticObjectsType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElementWrapper(name = "readonlyColumns")
@XmlElement(name = "readonlyColumn")
protected List<SyntheticReadonlyColumnType> readonlyColumns;

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
@ -48,7 +48,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -42,7 +42,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticReadonlyColumnType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tables;
@XmlElement(required = true)

View File

@ -41,7 +41,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticReadonlyRowidType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* &lt;all&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd}SyntheticKeyFieldsType"/&gt;
* &lt;/all&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
@ -47,7 +47,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -45,7 +45,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class SyntheticViewType implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String catalog;
@XmlJavaTypeAdapter(StringAdapter.class)

View File

@ -28,7 +28,7 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
public class Target implements Serializable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 31902L;
@XmlElement(defaultValue = "org.jooq.generated")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String packageName = "org.jooq.generated";

View File

@ -1,2 +1,2 @@
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.jooq.meta.jaxb;

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd"
xmlns:tns="http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:annox="http://annox.dev.java.net"
targetNamespace="http://www.jooq.org/xsd/jooq-codegen-3.19.0.xsd"
targetNamespace="http://www.jooq.org/xsd/jooq-codegen-3.19.2.xsd"
elementFormDefault="qualified"
jxb:extensionBindingPrefixes="annox"
jxb:version="2.1">
@ -235,7 +235,7 @@
<complexType name="MatchersCatalogsType">
<sequence>
<element name="catalog" type="tns:MatchersCatalogType" minOccurs="1" maxOccurs="unbounded"/>
<element name="catalog" type="tns:MatchersCatalogType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -270,7 +270,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersSchemasType">
<sequence>
<element name="schema" type="tns:MatchersSchemaType" minOccurs="1" maxOccurs="unbounded"/>
<element name="schema" type="tns:MatchersSchemaType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -305,7 +305,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersTablesType">
<sequence>
<element name="table" type="tns:MatchersTableType" minOccurs="1" maxOccurs="unbounded"/>
<element name="table" type="tns:MatchersTableType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -404,7 +404,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersIndexesType">
<sequence>
<element name="index" type="tns:MatchersIndexType" minOccurs="1" maxOccurs="unbounded"/>
<element name="index" type="tns:MatchersIndexType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -423,7 +423,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersPrimaryKeysType">
<sequence>
<element name="primaryKey" type="tns:MatchersPrimaryKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="primaryKey" type="tns:MatchersPrimaryKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -442,7 +442,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersUniqueKeysType">
<sequence>
<element name="uniqueKey" type="tns:MatchersUniqueKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="uniqueKey" type="tns:MatchersUniqueKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -461,7 +461,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersForeignKeysType">
<sequence>
<element name="foreignKey" type="tns:MatchersForeignKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="foreignKey" type="tns:MatchersForeignKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -492,7 +492,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersFieldsType">
<sequence>
<element name="field" type="tns:MatchersFieldType" minOccurs="1" maxOccurs="unbounded"/>
<element name="field" type="tns:MatchersFieldType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -523,7 +523,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersRoutinesType">
<sequence>
<element name="routine" type="tns:MatchersRoutineType" minOccurs="1" maxOccurs="unbounded"/>
<element name="routine" type="tns:MatchersRoutineType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -558,7 +558,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersSequencesType">
<sequence>
<element name="sequence" type="tns:MatchersSequenceType" minOccurs="1" maxOccurs="unbounded"/>
<element name="sequence" type="tns:MatchersSequenceType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -577,7 +577,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersEnumsType">
<sequence>
<element name="enum" type="tns:MatchersEnumType" minOccurs="1" maxOccurs="unbounded"/>
<element name="enum" type="tns:MatchersEnumType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -604,7 +604,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersEmbeddablesType">
<sequence>
<element name="embeddable" type="tns:MatchersEmbeddableType" minOccurs="1" maxOccurs="unbounded"/>
<element name="embeddable" type="tns:MatchersEmbeddableType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -655,7 +655,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersUDTsType">
<sequence>
<element name="udt" type="tns:MatchersUDTType" minOccurs="1" maxOccurs="unbounded"/>
<element name="udt" type="tns:MatchersUDTType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -742,7 +742,7 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<complexType name="MatchersAttributesType">
<sequence>
<element name="attribute" type="tns:MatchersAttributeType" minOccurs="1" maxOccurs="unbounded"/>
<element name="attribute" type="tns:MatchersAttributeType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1344,7 +1344,7 @@ for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
<complexType name="CommentsType">
<sequence>
<element name="comment" type="tns:CommentType" minOccurs="1" maxOccurs="unbounded"/>
<element name="comment" type="tns:CommentType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1422,7 +1422,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticReadonlyColumnsType">
<sequence>
<element name="readonlyColumn" type="tns:SyntheticReadonlyColumnType" minOccurs="1" maxOccurs="unbounded"/>
<element name="readonlyColumn" type="tns:SyntheticReadonlyColumnType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1441,7 +1441,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticReadonlyRowidsType">
<sequence>
<element name="readonlyRowid" type="tns:SyntheticReadonlyRowidType" minOccurs="1" maxOccurs="unbounded"/>
<element name="readonlyRowid" type="tns:SyntheticReadonlyRowidType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1462,7 +1462,7 @@ Use this along with the synthetic primary key feature to replace existing primar
<complexType name="SyntheticColumnsType">
<sequence>
<element name="column" type="tns:SyntheticColumnType" minOccurs="1" maxOccurs="unbounded"/>
<element name="column" type="tns:SyntheticColumnType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1489,7 +1489,7 @@ Use this along with the synthetic primary key feature to replace existing primar
<complexType name="SyntheticIdentitiesType">
<sequence>
<element name="identity" type="tns:SyntheticIdentityType" minOccurs="1" maxOccurs="unbounded"/>
<element name="identity" type="tns:SyntheticIdentityType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1508,7 +1508,7 @@ Use this along with the synthetic primary key feature to replace existing primar
<complexType name="SyntheticEnumsType">
<sequence>
<element name="enum" type="tns:SyntheticEnumType" minOccurs="1" maxOccurs="unbounded"/>
<element name="enum" type="tns:SyntheticEnumType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1551,13 +1551,13 @@ Use this along with the synthetic primary key feature to replace existing primar
<complexType name="SyntheticEnumLiteralsType">
<sequence>
<element name="literal" type="string" minOccurs="1" maxOccurs="unbounded"/>
<element name="literal" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="SyntheticPrimaryKeysType">
<sequence>
<element name="primaryKey" type="tns:SyntheticPrimaryKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="primaryKey" type="tns:SyntheticPrimaryKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1584,7 +1584,7 @@ Use this along with the synthetic primary key feature to replace existing primar
<complexType name="SyntheticUniqueKeysType">
<sequence>
<element name="uniqueKey" type="tns:SyntheticUniqueKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="uniqueKey" type="tns:SyntheticUniqueKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1609,7 +1609,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticForeignKeysType">
<sequence>
<element name="foreignKey" type="tns:SyntheticForeignKeyType" minOccurs="1" maxOccurs="unbounded"/>
<element name="foreignKey" type="tns:SyntheticForeignKeyType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1646,7 +1646,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticKeyFieldsType">
<sequence>
<element name="field" type="string" minOccurs="1" maxOccurs="unbounded">
<element name="field" type="string" minOccurs="0" maxOccurs="unbounded">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[A regular expression matching a key field that is referenced by a synthetic key.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
</sequence>
@ -1654,7 +1654,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticViewsType">
<sequence>
<element name="view" type="tns:SyntheticViewType" minOccurs="1" maxOccurs="unbounded"/>
<element name="view" type="tns:SyntheticViewType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1685,7 +1685,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticDaosType">
<sequence>
<element name="view" type="tns:SyntheticDaoType" minOccurs="1" maxOccurs="unbounded"/>
<element name="view" type="tns:SyntheticDaoType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1716,7 +1716,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SyntheticDaoMethodsType">
<sequence>
<element name="method" type="tns:SyntheticDaoMethodType" minOccurs="1" maxOccurs="unbounded"/>
<element name="method" type="tns:SyntheticDaoMethodType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1743,7 +1743,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="CatalogMappingsType">
<sequence>
<element name="catalog" type="tns:CatalogMappingType" minOccurs="1" maxOccurs="unbounded"/>
<element name="catalog" type="tns:CatalogMappingType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
@ -1770,7 +1770,7 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
<complexType name="SchemaMappingsType">
<sequence>
<element name="schema" type="tns:SchemaMappingType" minOccurs="1" maxOccurs="unbounded"/>
<element name="schema" type="tns:SchemaMappingType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>

View File

@ -139,7 +139,7 @@ public final class Constants {
/**
* The current jooq-codegen XSD file name.
*/
public static final String XSD_CODEGEN = "jooq-codegen-3.19.0.xsd";
public static final String XSD_CODEGEN = "jooq-codegen-3.19.2.xsd";
/**
* The current jooq-codegen XML namespace.

View File

@ -483,33 +483,59 @@ public final class MiniJAXB {
if (second == null)
return first;
Class<T> klass = (Class<T>) first.getClass();
if (!klass.isAssignableFrom(second.getClass()) && !second.getClass().isAssignableFrom(klass))
Class<T> firstClass = (Class<T>) first.getClass();
Class<T> secondClass = (Class<T>) second.getClass();
if (!firstClass.isAssignableFrom(secondClass) && !secondClass.isAssignableFrom(firstClass))
throw new IllegalArgumentException("Can only append compatible types");
// [#8527] support enum types
else if (klass.isEnum())
else if (firstClass.isEnum())
return first;
// We're assuming that XJC generated objects are all in the same package
Package pkg = klass.getPackage();
Package pkg = firstClass.getPackage();
try {
T defaults = klass.getDeclaredConstructor().newInstance();
for (Method setter : klass.getMethods()) {
if (setter.getName().startsWith("set")) {
Method getter;
// [#12985] [#15974] [#15966] Gradle generates a subclass for our configuration extensions, which
// will accept an injected argument. We shouldn't use that subclass here.
Class<T> defaultsClass = firstClass;
while (defaultsClass.getName().startsWith("org.jooq.codegen.gradle"))
defaultsClass = (Class<T>) defaultsClass.getSuperclass();
T defaults = defaultsClass.getDeclaredConstructor().newInstance();
methodLoop:
for (Method setter : firstClass.getMethods()) {
if (setter.getName().startsWith("set") && setter.getParameterCount() == 1) {
// [#12985] [#15974] [#15966] Don't call any gradle specific setters.
try {
getter = klass.getMethod("get" + setter.getName().substring(3));
defaultsClass.getMethod(setter.getName(), setter.getParameterTypes());
}
catch (NoSuchMethodException e) {
getter = klass.getMethod("is" + setter.getName().substring(3));
continue methodLoop;
}
Method defaultsGetter;
Method firstGetter;
Method secondGetter;
try {
defaultsGetter = defaultsClass.getMethod("get" + setter.getName().substring(3));
firstGetter = firstClass.getMethod("get" + setter.getName().substring(3));
secondGetter = secondClass.getMethod("get" + setter.getName().substring(3));
}
catch (NoSuchMethodException e) {
defaultsGetter = defaultsClass.getMethod("is" + setter.getName().substring(3));
firstGetter = firstClass.getMethod("is" + setter.getName().substring(3));
secondGetter = firstClass.getMethod("is" + setter.getName().substring(3));
}
Class<?> childType = setter.getParameterTypes()[0];
Object firstChild = getter.invoke(first);
Object secondChild = getter.invoke(second);
Object defaultChild = getter.invoke(defaults);
Object firstChild = firstGetter.invoke(first);
Object secondChild = secondGetter.invoke(second);
Object defaultChild = defaults != null ? defaultsGetter.invoke(defaults) : null;
if (Collection.class.isAssignableFrom(childType))
((List) firstChild).addAll((List) secondChild);