@@ -32,9 +32,6 @@ import org.thymeleaf.processor.IProcessor
3232import org.thymeleaf.standard.processor.StandardXmlNsTagProcessor
3333import org.thymeleaf.templatemode.TemplateMode
3434
35- import groovy.transform.builder.Builder
36- import groovy.transform.builder.SimpleStrategy
37-
3835/**
3936 * A dialect for Thymeleaf that lets you build layouts and reusable templates in
4037 * order to improve code reuse.
@@ -51,32 +48,30 @@ import groovy.transform.builder.SimpleStrategy
5148 *
5249 * @author Emanuel Rabina
5350 */
54- @Builder (
55- builderStrategy = SimpleStrategy ,
56- includes = [' sortingStrategy' , ' autoHeadMerging' , ' experimentalTitleTokens' ],
57- prefix = ' with'
58- )
5951class LayoutDialect extends AbstractProcessorDialect {
6052
6153 static final String DIALECT_NAME = ' Layout'
6254 static final String DIALECT_PREFIX = ' layout'
6355 static final int DIALECT_PRECEDENCE = 10
6456
65- SortingStrategy sortingStrategy = new AppendingStrategy ()
57+ @SuppressWarnings (' PrivateFieldCouldBeFinal' )
58+ private SortingStrategy sortingStrategy = new AppendingStrategy ()
6659
6760 /**
6861 * Experimental option, set to {@code false } to skip the automatic merging
6962 * of an HTML {@code <head> } section.
7063 */
71- boolean autoHeadMerging = true
64+ @SuppressWarnings (' PrivateFieldCouldBeFinal' )
65+ private boolean autoHeadMerging = true
7266
7367 /**
7468 * Experimental option, set to {@code true } to use standard Thymeleaf
7569 * expression syntax for title patterns and to have access to the title parts
7670 * in templates as the variables {@code layoutDialectContentTitle } and
7771 * {@code layoutDialectLayoutTitle }.
7872 */
79- boolean experimentalTitleTokens = false
73+ @SuppressWarnings (' PrivateFieldCouldBeFinal' )
74+ private boolean experimentalTitleTokens = false
8075
8176 /**
8277 * Constructor, configure the layout dialect.
@@ -125,4 +120,33 @@ class LayoutDialect extends AbstractProcessorDialect {
125120 new CollectFragmentProcessor (TemplateMode . XML , dialectPrefix)
126121 ]
127122 }
123+
124+ /**
125+ * Configure this instance of the layout dialect with the given {@code autoHeadMerging }
126+ * value.
127+ */
128+ LayoutDialect withAutoHeadMerging (boolean autoHeadMerging ) {
129+
130+ this . autoHeadMerging = autoHeadMerging
131+ return this
132+ }
133+
134+ /**
135+ * Configure this instance of the layout dialect with the given {@code experimentalTitleTokens }
136+ * value.
137+ */
138+ LayoutDialect withExperimentalTitleTokens (boolean experimentalTitleTokens ) {
139+
140+ this . experimentalTitleTokens = experimentalTitleTokens
141+ return this
142+ }
143+
144+ /**
145+ * Configure this instance of the layout dialect with the given {@code sortingStrategy }.
146+ */
147+ LayoutDialect withSortingStrategy (SortingStrategy sortingStrategy ) {
148+
149+ this . sortingStrategy = sortingStrategy
150+ return this
151+ }
128152}
0 commit comments