[jOOQ/jOOQ#9733] Add <generatedNonnullAnnotationType/> and <generatedNullableAnnotationType/>
This commit is contained in:
parent
54e8a53628
commit
2323b2a3e1
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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()));
|
||||
|
||||
@ -1140,6 +1140,14 @@ jOOQ version used for source code.]]></jxb:javadoc></jxb:property></appinfo></an
|
||||
jOOQ version used for source code.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="generatedNonnullAnnotationType" type="string" default="javax.annotation.Nonnull" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Specify the qualified annotation name for all non-nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nonnull} type.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="generatedNullableAnnotationType" type="string" default="javax.annotation.Nullable" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Specify the qualified annotation name for all nullable items in generated code, defaulting to the JSR-305 {@link javax.annotation.Nullable} type.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="routines" type="boolean" default="true" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate Routine classes.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user