10
10
import java .util .Date ;
11
11
import java .util .TimeZone ;
12
12
13
- public class HtmlBuilder {
13
+ // @formatter:off
14
+ public class HtmlBuilder implements MessageBuilder <HtmlBuilder > {
14
15
protected final StringBuilder message ;
15
16
16
17
public HtmlBuilder () {
17
18
this .message = new StringBuilder ();
18
19
}
19
20
21
+ @ Override
20
22
public HtmlBuilder icon (TelegramIconMode mode ) {
21
23
if (mode == null ) {
22
24
return this ;
@@ -25,6 +27,7 @@ public HtmlBuilder icon(TelegramIconMode mode) {
25
27
return this .space ();
26
28
}
27
29
30
+ @ Override
28
31
public HtmlBuilder icon (TelegramIconMode mode , int repeat ) {
29
32
if (mode == null ) {
30
33
return this ;
@@ -33,48 +36,58 @@ public HtmlBuilder icon(TelegramIconMode mode, int repeat) {
33
36
return this .space ();
34
37
}
35
38
39
+ @ Override
36
40
public HtmlBuilder timestamp (Date date , TimeZone timezone ) {
37
41
return this .code (Time4j .format (date , timezone ));
38
42
}
39
43
44
+ @ Override
40
45
public HtmlBuilder timestamp (Date date , TimeZone timezone , String format ) {
41
46
return this .code (Time4j .format (date , timezone , format ));
42
47
}
43
48
49
+ @ Override
44
50
public HtmlBuilder timestamp (Date date , TimezoneType timezone ) {
45
51
return this .code (Time4j .format (date , timezone ));
46
52
}
47
53
54
+ @ Override
48
55
public HtmlBuilder timestamp (Date date , TimezoneType timezone , String format ) {
49
56
return this .code (Time4j .format (date , timezone , format ));
50
57
}
51
58
59
+ @ Override
52
60
public HtmlBuilder timestamp (Date date , String format ) {
53
61
return this .code (Time4j .format (date , format ));
54
62
}
55
63
64
+ @ Override
56
65
public HtmlBuilder timestamp (Date date ) {
57
66
return this .code (Time4j .format (date , TimeFormatText .BIBLIOGRAPHY_COMPLETE_EPOCH_PATTERN ));
58
67
}
59
68
69
+ @ Override
60
70
public HtmlBuilder timestamp () {
61
71
return this .timestamp (new Date ());
62
72
}
63
73
74
+ @ Override
64
75
public HtmlBuilder vertical (String text ) {
65
76
message .append (String4j .repeat (Ascii .Symbol .VERTICAL_LINE , 2 ))
66
77
.append (text )
67
78
.append (String4j .repeat (Ascii .Symbol .VERTICAL_LINE , 2 ));
68
79
return this .space ();
69
80
}
70
81
82
+ @ Override
71
83
public HtmlBuilder vertical (Object value ) {
72
84
if (value == null ) {
73
85
return this ;
74
86
}
75
87
return this .vertical (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
76
88
}
77
89
90
+ @ Override
78
91
public HtmlBuilder bold (String text ) {
79
92
message .append (Ascii .Symbol .LESS_THAN_SIGN )
80
93
.append (Ascii .Lowercase .LATIN_SMALL_LETTER_B )
@@ -87,6 +100,7 @@ public HtmlBuilder bold(String text) {
87
100
return this .space ();
88
101
}
89
102
103
+ @ Override
90
104
public HtmlBuilder bold (Object value ) {
91
105
if (value == null ) {
92
106
return this ;
@@ -113,6 +127,7 @@ public HtmlBuilder strong(Object value) {
113
127
return this .strong (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
114
128
}
115
129
130
+ @ Override
116
131
public HtmlBuilder italic (String text ) {
117
132
message .append (Ascii .Symbol .LESS_THAN_SIGN )
118
133
.append (Ascii .Lowercase .LATIN_SMALL_LETTER_I )
@@ -125,6 +140,7 @@ public HtmlBuilder italic(String text) {
125
140
return this .space ();
126
141
}
127
142
143
+ @ Override
128
144
public HtmlBuilder italic (Object value ) {
129
145
if (value == null ) {
130
146
return this ;
@@ -151,6 +167,7 @@ public HtmlBuilder em(Object value) {
151
167
return this .em (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
152
168
}
153
169
170
+ @ Override
154
171
public HtmlBuilder underline (String text ) {
155
172
message .append (Ascii .Symbol .LESS_THAN_SIGN )
156
173
.append (Ascii .Lowercase .LATIN_SMALL_LETTER_U )
@@ -163,6 +180,7 @@ public HtmlBuilder underline(String text) {
163
180
return this .space ();
164
181
}
165
182
183
+ @ Override
166
184
public HtmlBuilder underline (Object value ) {
167
185
if (value == null ) {
168
186
return this ;
@@ -189,6 +207,7 @@ public HtmlBuilder ins(Object value) {
189
207
return this .ins (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
190
208
}
191
209
210
+ @ Override
192
211
public HtmlBuilder strikethrough (String text ) {
193
212
message .append (Ascii .Symbol .LESS_THAN_SIGN )
194
213
.append (Ascii .Lowercase .LATIN_SMALL_LETTER_S )
@@ -201,6 +220,7 @@ public HtmlBuilder strikethrough(String text) {
201
220
return this .space ();
202
221
}
203
222
223
+ @ Override
204
224
public HtmlBuilder strikethrough (Object value ) {
205
225
if (value == null ) {
206
226
return this ;
@@ -265,7 +285,8 @@ public HtmlBuilder spoiler(Object value) {
265
285
return this .spoiler (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
266
286
}
267
287
268
- public HtmlBuilder inlineUrl (String text , String url ) {
288
+ @ Override
289
+ public HtmlBuilder link (String text , String url ) {
269
290
message .append (Ascii .Symbol .LESS_THAN_SIGN )
270
291
.append (Ascii .Lowercase .LATIN_SMALL_LETTER_A )
271
292
.append (Ascii .Punctuation .SPACE )
@@ -284,6 +305,7 @@ public HtmlBuilder inlineUrl(String text, String url) {
284
305
return this .space ();
285
306
}
286
307
308
+ @ Override
287
309
public HtmlBuilder code (String text ) {
288
310
message .append (Ascii .Symbol .LESS_THAN_SIGN )
289
311
.append ("code" )
@@ -296,13 +318,15 @@ public HtmlBuilder code(String text) {
296
318
return this .space ();
297
319
}
298
320
321
+ @ Override
299
322
public HtmlBuilder code (Object value ) {
300
323
if (value == null ) {
301
324
return this ;
302
325
}
303
326
return this .code (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
304
327
}
305
328
329
+ @ Override
306
330
public HtmlBuilder code (Path filename ) {
307
331
try {
308
332
String data = Os4j .readFileKeepFormat (filename );
@@ -312,6 +336,7 @@ public HtmlBuilder code(Path filename) {
312
336
}
313
337
}
314
338
339
+ @ Override
315
340
public HtmlBuilder preformatted (String text ) {
316
341
message .append (Ascii .Symbol .LESS_THAN_SIGN )
317
342
.append ("pre" )
@@ -324,13 +349,15 @@ public HtmlBuilder preformatted(String text) {
324
349
return this .space ();
325
350
}
326
351
352
+ @ Override
327
353
public HtmlBuilder preformatted (Object value ) {
328
354
if (value == null ) {
329
355
return this ;
330
356
}
331
357
return this .preformatted (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
332
358
}
333
359
360
+ @ Override
334
361
public HtmlBuilder preformatted (String lang , String text ) {
335
362
message .append (Ascii .Symbol .LESS_THAN_SIGN )
336
363
.append ("pre" )
@@ -356,13 +383,15 @@ public HtmlBuilder preformatted(String lang, String text) {
356
383
return this .space ();
357
384
}
358
385
386
+ @ Override
359
387
public HtmlBuilder preformatted (String lang , Object value ) {
360
388
if (value == null ) {
361
389
return this ;
362
390
}
363
391
return this .preformatted (lang , Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
364
392
}
365
393
394
+ @ Override
366
395
public HtmlBuilder preformatted (String lang , Path filename ) {
367
396
try {
368
397
String data = Os4j .readFileKeepFormat (filename );
@@ -372,31 +401,37 @@ public HtmlBuilder preformatted(String lang, Path filename) {
372
401
}
373
402
}
374
403
404
+ @ Override
375
405
public HtmlBuilder text (String text ) {
376
406
message .append (text );
377
407
return this .space ();
378
408
}
379
409
410
+ @ Override
380
411
public HtmlBuilder text (Object value ) {
381
412
if (value == null ) {
382
413
return this ;
383
414
}
384
415
return this .text (Class4j .isPrimitive (value .getClass ()) ? value .toString () : Json4j .toJson (value ));
385
416
}
386
417
418
+ @ Override
387
419
public HtmlBuilder line () {
388
420
return this .text (System .lineSeparator ());
389
421
}
390
422
423
+ @ Override
391
424
public HtmlBuilder line (int repeat ) {
392
425
return this .text (String4j .repeat (System .lineSeparator (), repeat ));
393
426
}
394
427
428
+ @ Override
395
429
public HtmlBuilder space () {
396
430
message .append (Ascii .Punctuation .SPACE );
397
431
return this ;
398
432
}
399
433
434
+ @ Override
400
435
public HtmlBuilder space (int repeat ) {
401
436
message .append (String4j .repeat (Ascii .Punctuation .SPACE , repeat ));
402
437
return this ;
@@ -407,3 +442,4 @@ public String toString() {
407
442
return this .message .toString ();
408
443
}
409
444
}
445
+ // @formatter:on
0 commit comments