1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.internal.impl;
20
21 import org.apache.maven.api.annotations.Experimental;
22 import org.apache.maven.api.annotations.Nonnull;
23 import org.apache.maven.api.services.MessageBuilder;
24
25 @Experimental
26 public class DefaultMessageBuilder implements MessageBuilder {
27
28 private final StringBuilder buffer;
29
30 public DefaultMessageBuilder() {
31 this(new StringBuilder());
32 }
33
34 public DefaultMessageBuilder(StringBuilder buffer) {
35 this.buffer = buffer;
36 }
37
38 @Override
39 public MessageBuilder style(String style) {
40 return this;
41 }
42
43 @Override
44 public MessageBuilder resetStyle() {
45 return this;
46 }
47
48 @Override
49 public MessageBuilder append(CharSequence cs) {
50 buffer.append(cs);
51 return this;
52 }
53
54 @Override
55 public MessageBuilder append(CharSequence cs, int start, int end) {
56 buffer.append(cs, start, end);
57 return this;
58 }
59
60 @Override
61 public MessageBuilder append(char c) {
62 buffer.append(c);
63 return this;
64 }
65
66 @Override
67 public MessageBuilder setLength(int length) {
68 buffer.setLength(length);
69 return this;
70 }
71
72 @Override
73 @Nonnull
74 public String build() {
75 return buffer.toString();
76 }
77
78 @Override
79 public String toString() {
80 return build();
81 }
82 }