1 /*
2 * dpkg - Debian Package library and the Debian Package Maven plugin
3 * (c) Copyright 2016 Gerrit Hohl
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 package net.sourceforge.javadpkg.impl;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import net.sourceforge.javadpkg.ChangeLog;
25 import net.sourceforge.javadpkg.ChangeLogVersionEntry;
26
27
28 /**
29 * <p>
30 * A {@link ChangeLog} implementation.
31 * </p>
32 *
33 * @author Gerrit Hohl (gerrit-hohl@users.sourceforge.net)
34 * @version <b>1.0</b>, 04.05.2016 by Gerrit Hohl
35 */
36 public class ChangeLogImpl implements ChangeLog {
37
38
39 /** The entries. */
40 private List<ChangeLogVersionEntry> entries;
41
42
43 /**
44 * <p>
45 * Creates a change log.
46 * </p>
47 */
48 public ChangeLogImpl() {
49 super();
50
51 this.entries = new ArrayList<>();
52 }
53
54
55 /**
56 * <p>
57 * Add an entry to the change log.
58 * </p>
59 *
60 * @param entry
61 * The entry.
62 * @throws IllegalArgumentException
63 * If the entry is <code>null</code>.
64 */
65 public void addEntry(ChangeLogVersionEntry entry) {
66 if (entry == null)
67 throw new IllegalArgumentException("Argument entry is null.");
68
69 this.entries.add(entry);
70 }
71
72
73 @Override
74 public List<ChangeLogVersionEntry> getEntries() {
75 return (new ArrayList<>(this.entries));
76 }
77
78
79 }