diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java
index eafa3235a9..aae10c76b5 100644
--- a/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java
+++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java
@@ -65,7 +65,9 @@ abstract class AbstractGenerator implements Generator {
boolean generateImplicitJoinPathsToOne = true;
boolean generateInstanceFields = true;
boolean generateGeneratedAnnotation = false;
- GeneratedAnnotationType generateGeneratedAnnotationType = GeneratedAnnotationType.DETECT_FROM_JDK;
+ GeneratedAnnotationType generatedGeneratedAnnotationType = GeneratedAnnotationType.DETECT_FROM_JDK;
+ String generatedNonnullAnnotationType = "javax.annotation.Nonnull";
+ String generatedNullableAnnotationType = "javax.annotation.Nullable";
boolean useSchemaVersionProvider = false;
boolean useCatalogVersionProvider = false;
boolean generateRoutines = true;
@@ -289,12 +291,32 @@ abstract class AbstractGenerator implements Generator {
@Override
public GeneratedAnnotationType generateGeneratedAnnotationType() {
- return generateGeneratedAnnotationType;
+ return generatedGeneratedAnnotationType;
}
@Override
public void setGenerateGeneratedAnnotationType(GeneratedAnnotationType generateGeneratedAnnotationType) {
- this.generateGeneratedAnnotationType = generateGeneratedAnnotationType;
+ this.generatedGeneratedAnnotationType = generateGeneratedAnnotationType;
+ }
+
+ @Override
+ public String generatedNonnullAnnotationType() {
+ return generatedNonnullAnnotationType;
+ }
+
+ @Override
+ public void setGeneratedNonnullAnnotationType(String generatedNonnullAnnotationType) {
+ this.generatedNonnullAnnotationType = generatedNonnullAnnotationType;
+ }
+
+ @Override
+ public String generatedNullableAnnotationType() {
+ return generatedNullableAnnotationType;
+ }
+
+ @Override
+ public void setGeneratedNullableAnnotationType(String generatedNullableAnnotationType) {
+ this.generatedNullableAnnotationType = generatedNullableAnnotationType;
}
@Override
diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java
index f831de0d39..0dd4fd380a 100644
--- a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java
+++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java
@@ -669,6 +669,10 @@ public class GenerationTool {
generator.setGenerateGeneratedAnnotation(g.getGenerate().isGeneratedAnnotation());
if (g.getGenerate().getGeneratedAnnotationType() != null)
generator.setGenerateGeneratedAnnotationType(g.getGenerate().getGeneratedAnnotationType());
+ if (g.getGenerate().getGeneratedNonnullAnnotationType() != null)
+ generator.setGeneratedNonnullAnnotationType(g.getGenerate().getGeneratedNonnullAnnotationType());
+ if (g.getGenerate().getGeneratedNullableAnnotationType() != null)
+ generator.setGeneratedNullableAnnotationType(g.getGenerate().getGeneratedNullableAnnotationType());
if (g.getGenerate().isRoutines() != null)
generator.setGenerateRoutines(g.getGenerate().isRoutines());
if (g.getGenerate().isSequences() != null)
diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java
index a038e4582c..b67b9b7312 100644
--- a/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java
+++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java
@@ -157,6 +157,26 @@ public interface Generator {
*/
void setGenerateGeneratedAnnotationType(GeneratedAnnotationType generateGeneratedAnnotationType);
+ /**
+ * Which type of Nonnull annotation should be generated.
+ */
+ String generatedNonnullAnnotationType();
+
+ /**
+ * Which type of Nonnull annotation should be generated.
+ */
+ void setGeneratedNonnullAnnotationType(String generatedNonnullAnnotationType);
+
+ /**
+ * Which type of Nullable annotation should be generated.
+ */
+ String generatedNullableAnnotationType();
+
+ /**
+ * Which type of Nullable annotation should be generated.
+ */
+ void setGeneratedNullableAnnotationType(String generatedNullableAnnotationType);
+
boolean useSchemaVersionProvider();
void setUseSchemaVersionProvider(boolean useSchemaVersionProvider);
boolean useCatalogVersionProvider();
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java
index 613886f9ba..194cf219f4 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java
@@ -49,6 +49,12 @@ public class Generate implements Serializable, XMLAppendable
@XmlElement(defaultValue = "DETECT_FROM_JDK")
@XmlSchemaType(name = "string")
protected GeneratedAnnotationType generatedAnnotationType = GeneratedAnnotationType.DETECT_FROM_JDK;
+ @XmlElement(defaultValue = "javax.annotation.Nonnull")
+ @XmlJavaTypeAdapter(StringAdapter.class)
+ protected String generatedNonnullAnnotationType = "javax.annotation.Nonnull";
+ @XmlElement(defaultValue = "javax.annotation.Nullable")
+ @XmlJavaTypeAdapter(StringAdapter.class)
+ protected String generatedNullableAnnotationType = "javax.annotation.Nullable";
@XmlElement(defaultValue = "true")
protected Boolean routines = true;
@XmlElement(defaultValue = "true")
@@ -386,6 +392,38 @@ public class Generate implements Serializable, XMLAppendable
this.generatedAnnotationType = value;
}
+ /**
+ * Specify the qualified annotation name for all non-nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nonnull} type.
+ *
+ */
+ public String getGeneratedNonnullAnnotationType() {
+ return generatedNonnullAnnotationType;
+ }
+
+ /**
+ * Specify the qualified annotation name for all non-nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nonnull} type.
+ *
+ */
+ public void setGeneratedNonnullAnnotationType(String value) {
+ this.generatedNonnullAnnotationType = value;
+ }
+
+ /**
+ * Specify the qualified annotation name for all nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nullable} type.
+ *
+ */
+ public String getGeneratedNullableAnnotationType() {
+ return generatedNullableAnnotationType;
+ }
+
+ /**
+ * Specify the qualified annotation name for all nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nullable} type.
+ *
+ */
+ public void setGeneratedNullableAnnotationType(String value) {
+ this.generatedNullableAnnotationType = value;
+ }
+
/**
* Generate Routine classes.
*
@@ -1850,6 +1888,24 @@ public class Generate implements Serializable, XMLAppendable
return this;
}
+ /**
+ * Specify the qualified annotation name for all non-nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nonnull} type.
+ *
+ */
+ public Generate withGeneratedNonnullAnnotationType(String value) {
+ setGeneratedNonnullAnnotationType(value);
+ return this;
+ }
+
+ /**
+ * Specify the qualified annotation name for all nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nullable} type.
+ *
+ */
+ public Generate withGeneratedNullableAnnotationType(String value) {
+ setGeneratedNullableAnnotationType(value);
+ return this;
+ }
+
public Generate withRoutines(Boolean value) {
setRoutines(value);
return this;
@@ -2176,6 +2232,8 @@ public class Generate implements Serializable, XMLAppendable
builder.append("instanceFields", instanceFields);
builder.append("generatedAnnotation", generatedAnnotation);
builder.append("generatedAnnotationType", generatedAnnotationType);
+ builder.append("generatedNonnullAnnotationType", generatedNonnullAnnotationType);
+ builder.append("generatedNullableAnnotationType", generatedNullableAnnotationType);
builder.append("routines", routines);
builder.append("sequences", sequences);
builder.append("udts", udts);
@@ -2337,6 +2395,24 @@ public class Generate implements Serializable, XMLAppendable
return false;
}
}
+ if (generatedNonnullAnnotationType == null) {
+ if (other.generatedNonnullAnnotationType!= null) {
+ return false;
+ }
+ } else {
+ if (!generatedNonnullAnnotationType.equals(other.generatedNonnullAnnotationType)) {
+ return false;
+ }
+ }
+ if (generatedNullableAnnotationType == null) {
+ if (other.generatedNullableAnnotationType!= null) {
+ return false;
+ }
+ } else {
+ if (!generatedNullableAnnotationType.equals(other.generatedNullableAnnotationType)) {
+ return false;
+ }
+ }
if (routines == null) {
if (other.routines!= null) {
return false;
@@ -2884,6 +2960,8 @@ public class Generate implements Serializable, XMLAppendable
result = ((prime*result)+((instanceFields == null)? 0 :instanceFields.hashCode()));
result = ((prime*result)+((generatedAnnotation == null)? 0 :generatedAnnotation.hashCode()));
result = ((prime*result)+((generatedAnnotationType == null)? 0 :generatedAnnotationType.hashCode()));
+ result = ((prime*result)+((generatedNonnullAnnotationType == null)? 0 :generatedNonnullAnnotationType.hashCode()));
+ result = ((prime*result)+((generatedNullableAnnotationType == null)? 0 :generatedNullableAnnotationType.hashCode()));
result = ((prime*result)+((routines == null)? 0 :routines.hashCode()));
result = ((prime*result)+((sequences == null)? 0 :sequences.hashCode()));
result = ((prime*result)+((udts == null)? 0 :udts.hashCode()));
diff --git a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.13.0.xsd b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.13.0.xsd
index 5d978f7ad4..aaa6630b0d 100644
--- a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.13.0.xsd
+++ b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.13.0.xsd
@@ -1140,6 +1140,14 @@ jOOQ version used for source code.]]>
+
+
+
+
+
+
+
+