1 package org.apache.maven.changelog;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import java.util.Collection;
22 import java.util.Iterator;
23
24 /**
25 * Change Log Set - holds details about a set of change log entries.
26 *
27 * @author <a href="mailto:david.jackman@fastsearch.com">David Jackman</a>
28 * @version $$
29 */
30 public class ChangeLogSet
31 {
32 private final Collection entries;
33 private final String start;
34 private final String end;
35
36 /**
37 * Initializes a new instance of this class.
38 *
39 * @param entries collection of {@link ChangeLogEntry} objects for this set.
40 * @param start the start date/tag for this set.
41 * @param end the end date/tag for this set, or <code>null</code> if this set goes to the present time.
42 */
43 public ChangeLogSet( Collection entries, String start, String end )
44 {
45 this.entries = entries;
46 this.start = start;
47 this.end = end;
48 }
49
50 /**
51 * Returns the collection of entries for this set.
52 *
53 * @return the collection of {@link ChangeLogEntry} objects for this set.
54 */
55 public Collection getEntries()
56 {
57 return entries;
58 }
59
60 /**
61 * Returns the start date/tag for this set.
62 *
63 * @return the start date/tag for this set.
64 */
65 public String getStart()
66 {
67 return start;
68 }
69
70 /**
71 * Returns the end date/tag for this set.
72 *
73 * @return the end date/tag for this set, or <code>null</code> if this set goes to the present time.
74 */
75 public String getEnd()
76 {
77 return end;
78 }
79
80 /**
81 * Creates an XML representation of this change log set.
82 */
83 public String toXML()
84 {
85 StringBuffer buffer = new StringBuffer();
86
87 buffer.append( "<changeset start=\"" ).append( start )
88 .append( "\" end=\"" ).append( end ).append( "\">\n" );
89
90
91 for ( Iterator i = getEntries().iterator(); i.hasNext(); )
92 {
93 buffer.append( ( (ChangeLogEntry) i.next() ).toXML() );
94 }
95
96 buffer.append( "</changeset>\n" );
97
98 return buffer.toString();
99 }
100 }