[jOOQ/jOOQ#9817] Added config
This commit is contained in:
parent
65e3a39f2b
commit
0d60fd887f
@ -51,6 +51,7 @@ import java.util.stream.Stream;
|
||||
import org.jooq.meta.Database;
|
||||
import org.jooq.meta.jaxb.GeneratedAnnotationType;
|
||||
import org.jooq.meta.jaxb.GeneratedSerialVersionUID;
|
||||
import org.jooq.meta.jaxb.GeneratedTextBlocks;
|
||||
import org.jooq.meta.jaxb.VisibilityModifier;
|
||||
import org.jooq.tools.JooqLogger;
|
||||
|
||||
@ -168,6 +169,7 @@ abstract class AbstractGenerator implements Generator {
|
||||
String generateNewline = "\n";
|
||||
String generateIndentation;
|
||||
int generatePrintMarginForBlockComment = 80;
|
||||
GeneratedTextBlocks generateTextBlocks = GeneratedTextBlocks.DETECT_FROM_JDK;
|
||||
|
||||
protected GeneratorStrategyWrapper strategy;
|
||||
protected String targetEncoding = "UTF-8";
|
||||
@ -1337,6 +1339,16 @@ abstract class AbstractGenerator implements Generator {
|
||||
this.generatePrintMarginForBlockComment = printMarginForBlockComment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedTextBlocks generateTextBlocks() {
|
||||
return generateTextBlocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenerateTextBlocks(GeneratedTextBlocks textBlocks) {
|
||||
this.generateTextBlocks = textBlocks;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@Override
|
||||
|
||||
@ -914,6 +914,8 @@ public class GenerationTool {
|
||||
generator.setGenerateIndentation(g.getGenerate().getIndentation());
|
||||
if (g.getGenerate().getPrintMarginForBlockComment() != null)
|
||||
generator.setGeneratePrintMarginForBlockComment(g.getGenerate().getPrintMarginForBlockComment());
|
||||
if (g.getGenerate().getTextBlocks() != null)
|
||||
generator.setGenerateTextBlocks(g.getGenerate().getTextBlocks());
|
||||
|
||||
|
||||
if (!isBlank(d.getSchemaVersionProvider()))
|
||||
|
||||
@ -53,6 +53,7 @@ import org.jooq.meta.ForeignKeyDefinition;
|
||||
import org.jooq.meta.TableDefinition;
|
||||
import org.jooq.meta.jaxb.GeneratedAnnotationType;
|
||||
import org.jooq.meta.jaxb.GeneratedSerialVersionUID;
|
||||
import org.jooq.meta.jaxb.GeneratedTextBlocks;
|
||||
import org.jooq.meta.jaxb.VisibilityModifier;
|
||||
import org.jooq.types.Interval;
|
||||
|
||||
@ -1254,6 +1255,16 @@ public interface Generator {
|
||||
*/
|
||||
void setGeneratePrintMarginForBlockComment(int printMarginForBlockComment);
|
||||
|
||||
/**
|
||||
* Whether to generate String in text block format.
|
||||
*/
|
||||
GeneratedTextBlocks generateTextBlocks();
|
||||
|
||||
/**
|
||||
* Whether to generate String in text block format.
|
||||
*/
|
||||
void setGenerateTextBlocks(GeneratedTextBlocks textBlocks);
|
||||
|
||||
/**
|
||||
* The target directory
|
||||
*/
|
||||
|
||||
@ -237,6 +237,9 @@ public class Generate implements Serializable, XMLAppendable
|
||||
protected String indentation;
|
||||
@XmlElement(defaultValue = "80")
|
||||
protected Integer printMarginForBlockComment = 80;
|
||||
@XmlElement(defaultValue = "DETECT_FROM_JDK")
|
||||
@XmlSchemaType(name = "string")
|
||||
protected GeneratedTextBlocks textBlocks = GeneratedTextBlocks.DETECT_FROM_JDK;
|
||||
|
||||
/**
|
||||
* Generate index information.
|
||||
@ -2634,6 +2637,22 @@ public class Generate implements Serializable, XMLAppendable
|
||||
this.printMarginForBlockComment = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to generate String in text block format.
|
||||
*
|
||||
*/
|
||||
public GeneratedTextBlocks getTextBlocks() {
|
||||
return textBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to generate String in text block format.
|
||||
*
|
||||
*/
|
||||
public void setTextBlocks(GeneratedTextBlocks value) {
|
||||
this.textBlocks = value;
|
||||
}
|
||||
|
||||
public Generate withIndexes(Boolean value) {
|
||||
setIndexes(value);
|
||||
return this;
|
||||
@ -3188,6 +3207,15 @@ public class Generate implements Serializable, XMLAppendable
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to generate String in text block format.
|
||||
*
|
||||
*/
|
||||
public Generate withTextBlocks(GeneratedTextBlocks value) {
|
||||
setTextBlocks(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void appendTo(XMLBuilder builder) {
|
||||
builder.append("indexes", indexes);
|
||||
@ -3291,6 +3319,7 @@ public class Generate implements Serializable, XMLAppendable
|
||||
builder.append("newline", newline);
|
||||
builder.append("indentation", indentation);
|
||||
builder.append("printMarginForBlockComment", printMarginForBlockComment);
|
||||
builder.append("textBlocks", textBlocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -4221,6 +4250,15 @@ public class Generate implements Serializable, XMLAppendable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (textBlocks == null) {
|
||||
if (other.textBlocks!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!textBlocks.equals(other.textBlocks)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4329,6 +4367,7 @@ public class Generate implements Serializable, XMLAppendable
|
||||
result = ((prime*result)+((newline == null)? 0 :newline.hashCode()));
|
||||
result = ((prime*result)+((indentation == null)? 0 :indentation.hashCode()));
|
||||
result = ((prime*result)+((printMarginForBlockComment == null)? 0 :printMarginForBlockComment.hashCode()));
|
||||
result = ((prime*result)+((textBlocks == null)? 0 :textBlocks.hashCode()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
package org.jooq.meta.jaxb;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlEnum;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for GeneratedTextBlocks.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
* <pre>
|
||||
* <simpleType name="GeneratedTextBlocks">
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="DETECT_FROM_JDK"/>
|
||||
* <enumeration value="ON"/>
|
||||
* <enumeration value="OFF"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@XmlType(name = "GeneratedTextBlocks")
|
||||
@XmlEnum
|
||||
public enum GeneratedTextBlocks {
|
||||
|
||||
DETECT_FROM_JDK,
|
||||
ON,
|
||||
OFF;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static GeneratedTextBlocks fromValue(String v) {
|
||||
return valueOf(v);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2278,6 +2278,10 @@ This flag is ignored in the commercial Java 6 distribution of jOOQ 3.9+ ]]></jxb
|
||||
<element name="printMarginForBlockComment" type="int" minOccurs="0" maxOccurs="1" default="80">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The print margin to apply to generated Javadoc and other block comments, for automatic line wrapping. The feature is turned off if the print margin is <code>0</code>.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="textBlocks" type="tns:GeneratedTextBlocks" minOccurs="0" maxOccurs="1" default="DETECT_FROM_JDK">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether to generate String in text block format.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
@ -2362,6 +2366,14 @@ e.g. org.jooq.generated.schema1, org.jooq.generated.schema2]]></jxb:javadoc></jx
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="GeneratedTextBlocks">
|
||||
<restriction base="string">
|
||||
<enumeration value="DETECT_FROM_JDK"/>
|
||||
<enumeration value="ON"/>
|
||||
<enumeration value="OFF"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="GeneratedSerialVersionUID">
|
||||
<restriction base="string">
|
||||
<enumeration value="HASH"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user