01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.pretty;
10:
11: import org.acm.seguin.util.FileSettings;
12:
13: /**
14: * Description of the Class
15: *
16: *@author Chris Seguin
17: */
18: public class DescriptionPadder {
19: /**
20: * Description of the Method
21: *
22: *@param bundle Description of Parameter
23: *@param key Description of Parameter
24: *@param defaultValue Value to use if the key cannot be found.
25: *@return Value for the key (or defaultValue if the key cannot be found).
26: */
27: public static String find(FileSettings bundle, String key,
28: String defaultValue) {
29: String message = bundle.getProperty(key, defaultValue);
30: return padBuffer(message, bundle);
31: }
32:
33: /**
34: * Description of the Method
35: *
36: *@param bundle Description of Parameter
37: *@param key Description of Parameter
38: *@return alue for the key (or "" if the key cannot be found).
39: */
40: public static String find(FileSettings bundle, String key) {
41: String message = bundle.getProperty(key, "");
42: return padBuffer(message, bundle);
43: }
44:
45: /**
46: * Pads the buffer
47: *
48: *@param message Description of Parameter
49: *@param bundle Description of Parameter
50: *@return Description of the Returned Value
51: */
52: public static String padBuffer(String message, FileSettings bundle) {
53: if (!bundle.getBoolean("reformat.comments")) {
54: StringBuffer buffer = new StringBuffer(message);
55: int count = bundle.getInteger("javadoc.indent");
56: for (int ndx = 0; ndx < count; ndx++) {
57: buffer.insert(0, " ");
58: }
59: return buffer.toString();
60: }
61: return message;
62: }
63: }
64: // This is the end of the file
|