@@ -34,10 +34,10 @@ class Text extends BaseTemplate {
34
34
/**
35
35
* The plain text. Required.
36
36
*/
37
- private StringBuilder text ;
37
+ private final StringBuilder text ;
38
38
39
39
/** The escape's char or empty. */
40
- private String escapeChar ;
40
+ private final String escapeChar ;
41
41
42
42
/**
43
43
* Creates a new {@link Text}.
@@ -67,27 +67,21 @@ public String text() {
67
67
return escapeChar + text .toString ();
68
68
}
69
69
70
- /**
71
- * @return Same as {@link #text()} without the escape char.
72
- */
73
- public char [] textWithoutEscapeChar () {
74
- return text .toString ().toCharArray ();
75
- }
76
-
77
70
@ Override
78
71
protected void merge (final Context scope , final Writer writer ) throws IOException {
79
72
writer .write (text .toString ());
80
73
}
81
74
82
75
/**
83
- * Append text .
76
+ * Merges the content of the given {@link Text} instance into this instance .
84
77
*
85
- * @param text The text to append.
86
- * @return This object.
78
+ * @param other the {@link Text} instance to merge with this instance;
79
+ * if null or contains no text, no action is taken
87
80
*/
88
- public Text append (final char [] text ) {
89
- this .text .append (text );
90
- return this ;
91
- }
81
+ public void append (final Text other ) {
82
+ if (other != null && other .text != null ) {
83
+ this .text .append (other .text );
84
+ }
85
+ }
92
86
93
87
}
0 commit comments