From e3c991176a53121adcdd12b852efa50ea2c69874 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Thu, 16 Mar 2017 12:47:50 +0100 Subject: [PATCH] [#5973] Copy constructor performance optimisation --- jOOQ/src/main/java/org/jooq/JSONFormat.java | 18 ++++++++++++++---- jOOQ/src/main/java/org/jooq/XMLFormat.java | 10 +++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/JSONFormat.java b/jOOQ/src/main/java/org/jooq/JSONFormat.java index 36faa7a344..f02d37c589 100644 --- a/jOOQ/src/main/java/org/jooq/JSONFormat.java +++ b/jOOQ/src/main/java/org/jooq/JSONFormat.java @@ -77,6 +77,7 @@ public final class JSONFormat { false, "\n", 2, + null, true, RecordFormat.ARRAY ); @@ -86,13 +87,14 @@ public final class JSONFormat { boolean format, String newline, int indent, + String[] indented, boolean header, RecordFormat recordFormat ) { this.format = format; this.newline = newline; this.indent = indent; - this.indented = new String[] { + this.indented = indented != null ? indented : new String[] { "", format ? rightPad("", indent * 1) : "", format ? rightPad("", indent * 2) : "", @@ -110,8 +112,10 @@ public final class JSONFormat { newFormat, newline, indent, + null, header, - recordFormat); + recordFormat + ); } /** @@ -129,6 +133,7 @@ public final class JSONFormat { format, newNewline, indent, + indented, header, recordFormat ); @@ -149,6 +154,7 @@ public final class JSONFormat { format, newline, newIndent, + null, header, recordFormat ); @@ -182,8 +188,10 @@ public final class JSONFormat { format, newline, indent, + indented, newHeader, - recordFormat); + recordFormat + ); } /** @@ -203,8 +211,10 @@ public final class JSONFormat { format, newline, indent, + indented, header, - newRecordFormat); + newRecordFormat + ); } /** diff --git a/jOOQ/src/main/java/org/jooq/XMLFormat.java b/jOOQ/src/main/java/org/jooq/XMLFormat.java index 01ec3cb1c4..9cab0fb6cf 100644 --- a/jOOQ/src/main/java/org/jooq/XMLFormat.java +++ b/jOOQ/src/main/java/org/jooq/XMLFormat.java @@ -60,6 +60,7 @@ public final class XMLFormat { false, "\n", 2, + null, true, RecordFormat.VALUE_ELEMENTS_WITH_FIELD_ATTRIBUTE ); @@ -70,6 +71,7 @@ public final class XMLFormat { boolean format, String newline, int indent, + String[] indented, boolean header, RecordFormat recordFormat ) { @@ -77,7 +79,7 @@ public final class XMLFormat { this.format = format; this.newline = newline; this.indent = indent; - this.indented = new String[] { + this.indented = indented != null ? indented : new String[] { "", format ? rightPad("", indent * 1) : "", format ? rightPad("", indent * 2) : "", @@ -96,6 +98,7 @@ public final class XMLFormat { format, newline, indent, + indented, header, recordFormat ); @@ -117,6 +120,7 @@ public final class XMLFormat { newFormat, newline, indent, + null, header, recordFormat ); @@ -138,6 +142,7 @@ public final class XMLFormat { format, newNewline, indent, + indented, header, recordFormat ); @@ -159,6 +164,7 @@ public final class XMLFormat { format, newline, newIndent, + null, header, recordFormat ); @@ -198,6 +204,7 @@ public final class XMLFormat { format, newline, indent, + indented, newHeader, recordFormat ); @@ -220,6 +227,7 @@ public final class XMLFormat { format, newline, indent, + indented, header, newRecordFormat );