1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.javadpkg.control.impl;
20
21 import net.sourceforge.javadpkg.BuildException;
22 import net.sourceforge.javadpkg.Context;
23 import net.sourceforge.javadpkg.control.Description;
24 import net.sourceforge.javadpkg.control.DescriptionBuilder;
25
26
27
28
29
30
31
32
33
34
35 public class DescriptionBuilderImpl implements DescriptionBuilder {
36
37
38
39
40
41
42
43 public DescriptionBuilderImpl() {
44 super();
45 }
46
47
48 @Override
49 public String buildDescription(Description description, Context context) throws BuildException {
50 String text;
51 String[] lines;
52 StringBuilder sb;
53
54
55 if (description == null)
56 throw new IllegalArgumentException("Argument description is null.");
57 if (context == null)
58 throw new IllegalArgumentException("Argument context is null.");
59
60 text = description.getText();
61 lines = text.split("\n", -1);
62 sb = new StringBuilder();
63 for (String line : lines) {
64 if (sb.length() > 0) {
65 sb.append('\n');
66 }
67 if (line.isEmpty()) {
68 sb.append('.');
69 } else {
70 sb.append(line);
71 }
72 }
73 return sb.toString();
74 }
75
76
77 }