@@ -32,67 +32,57 @@ 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+
3538/**
3639 * A dialect for Thymeleaf that lets you build layouts and reusable templates in
37- * order to improve code reuse
40+ * order to improve code reuse.
41+ * <p >
42+ * To configure the layout dialect, you have 2 options:
43+ * <ul >
44+ * <li >the constructor with arguments {@code LayoutDialect(SortingStrategy, boolean) }</li>
45+ * <li >the fluent API methods {@link #withAutoHeadMerging}, {@link #withExperimentalTitleTokens},
46+ * and {@link #withSortingStrategy}</li>
47+ * </ul>
48+ * <p >Note that the fluent API is currently the only way to enable the {@code experimentatlTitleTokens }
49+ * setting. With the number of options growing, the constructor might be
50+ * deprecated in favour of the fluent API methods.
3851 *
3952 * @author Emanuel Rabina
4053 */
54+ @Builder (builderStrategy = SimpleStrategy , prefix = ' with' )
4155class LayoutDialect extends AbstractProcessorDialect {
4256
4357 static final String DIALECT_NAME = ' Layout'
4458 static final String DIALECT_PREFIX = ' layout'
4559 static final int DIALECT_PRECEDENCE = 10
4660
47- SortingStrategy sortingStrategy = new AppendingStrategy ()
61+ private SortingStrategy sortingStrategy = new AppendingStrategy ()
4862
4963 /**
5064 * Experimental option, set to {@code false } to skip the automatic merging
5165 * of an HTML {@code <head> } section.
5266 */
53- boolean autoHeadMerging = true
67+ private boolean autoHeadMerging = true
5468
5569 /**
5670 * Experimental option, set to {@code true } to use standard Thymeleaf
5771 * expression syntax for title patterns and to have access to the title parts
5872 * in templates as the variables {@code layoutDialectContentTitle } and
5973 * {@code layoutDialectLayoutTitle }.
6074 */
61- boolean experimentalTitleTokens = false
62-
63- /**
64- * Constructor, create the layout dialect in the default configuration.
65- */
66- LayoutDialect () {
67-
68- this (new AppendingStrategy (), true )
69- }
70-
71- /**
72- * Constructor, create the layout dialect with the specified {@code <head> }
73- * sorting strategy.
74- *
75- * @deprecated
76- * Use the appropriate setters to configure the layout dialect instead.
77- */
78- @Deprecated
79- LayoutDialect (SortingStrategy sortingStrategy ) {
80-
81- this (sortingStrategy, true )
82- }
75+ private boolean experimentalTitleTokens = false
8376
8477 /**
8578 * Constructor, configure the layout dialect.
8679 *
87- * @deprecated
88- * Use the appropriate setters to configure the layout dialect instead.
8980 * @param sortingStrategy
9081 * @param autoHeadMerging
9182 * Experimental option, set to {@code false } to skip the automatic merging
9283 * of an HTML {@code <head> } section.
9384 */
94- @Deprecated
95- LayoutDialect (SortingStrategy sortingStrategy , boolean autoHeadMerging ) {
85+ LayoutDialect (SortingStrategy sortingStrategy = new AppendingStrategy (), boolean autoHeadMerging = true ) {
9686
9787 super (DIALECT_NAME , DIALECT_PREFIX , DIALECT_PRECEDENCE )
9888
0 commit comments