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.PackageVersion;
24 import net.sourceforge.javadpkg.control.PackageVersionBuilder;
25
26
27
28
29
30
31
32
33
34
35 public class PackageVersionBuilderImpl implements PackageVersionBuilder {
36
37
38
39
40
41
42
43 public PackageVersionBuilderImpl() {
44 super();
45 }
46
47
48 @Override
49 public String buildPackageVersion(PackageVersion version, Context context) throws BuildException {
50 StringBuilder result;
51 String value;
52
53
54 if (version == null)
55 throw new IllegalArgumentException("Argument version is null.");
56 if (context == null)
57 throw new IllegalArgumentException("Argument context is null.");
58
59 result = new StringBuilder();
60
61
62 value = version.getEpoch();
63 if (value != null) {
64 result.append(value);
65 result.append(':');
66 }
67
68
69 result.append(version.getUpstreamVersion());
70
71
72 value = version.getDebianRevision();
73 if (value != null) {
74 result.append('-');
75 result.append(value);
76 }
77
78 return result.toString();
79 }
80
81
82 }