View Javadoc
1   package org.apache.maven.shared.utils.logging;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Message builder that supports configurable styling.
24   * @see MessageUtils
25   * @since 3.1.0
26   */
27  public interface MessageBuilder
28  {
29      /**
30       * Append message content in success style.
31       * By default, bold green
32       * @param message the message to append
33       * @return the current builder
34       */
35      MessageBuilder success( Object message );
36      
37      /**
38       * Append message content in warning style.
39       * By default, bold yellow
40       * @param message the message to append
41       * @return the current builder
42       */
43      MessageBuilder warning( Object message );
44      
45      /**
46       * Append message content in failure style.
47       * By default, bold red
48       * @param message the message to append
49       * @return the current builder
50       */
51      MessageBuilder failure( Object message );
52  
53      /**
54       * Append message content in strong style.
55       * By default, bold
56       * @param message the message to append
57       * @return the current builder
58       */
59      MessageBuilder strong( Object message );
60      
61      /**
62       * Append message content in mojo style.
63       * By default, green
64       * @param message the message to append
65       * @return the current builder
66       */
67      MessageBuilder mojo( Object message );
68      
69      /**
70       * Append message content in project style.
71       * By default, cyan
72       * @param message the message to append
73       * @return the current builder
74       */
75      MessageBuilder project( Object message );
76      
77      //
78      // message building methods modelled after Ansi methods
79      //
80      /**
81       * Append content to the message buffer.
82       * @param value the content to append
83       * @param offset the index of the first {@code char} to append
84       * @param len the number of {@code char}s to append
85       * @return the current builder
86       */
87      MessageBuilder a( char[] value, int offset, int len );
88  
89      /**
90       * Append content to the message buffer.
91       * @param value the content to append
92       * @return the current builder
93       */
94      MessageBuilder a( char[] value );
95  
96      /**
97       * Append content to the message buffer.
98       * @param value the content to append
99       * @param start the starting index of the subsequence to be appended
100      * @param end the end index of the subsequence to be appended
101      * @return the current builder
102      */
103     MessageBuilder a( CharSequence value, int start, int end );
104 
105     /**
106      * Append content to the message buffer.
107      * @param value the content to append
108      * @return the current builder
109      */
110     MessageBuilder a( CharSequence value );
111 
112     /**
113      * Append content to the message buffer.
114      * @param value the content to append
115      * @return the current builder
116      */
117     MessageBuilder a( Object value );
118 
119     /**
120      * Append newline to the message buffer.
121      * @return the current builder
122      */
123     MessageBuilder newline();
124 
125     /**
126      * Append formatted content to the buffer.
127      * @see String#format(String, Object...)
128      * @param pattern a <a href="../util/Formatter.html#syntax">format string</a>
129      * @param args arguments referenced by the format specifiers in the format string.
130      * @return the current builder
131      */
132     MessageBuilder format( String pattern, Object... args );
133 }