1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.shared.release.transform.jdom2;
20
21 import org.apache.maven.shared.release.transform.MavenCoordinate;
22 import org.jdom2.Element;
23
24
25
26
27
28
29
30 public class JDomMavenCoordinate implements MavenCoordinate {
31 private final Element element;
32
33
34
35
36
37
38 public JDomMavenCoordinate(Element elm) {
39 this.element = elm;
40 }
41
42 @Override
43 public String getGroupId() {
44 return element.getChildTextTrim("groupId", element.getNamespace());
45 }
46
47 @Override
48 public String getArtifactId() {
49 return element.getChildTextTrim("artifactId", element.getNamespace());
50 }
51
52 @Override
53 public String getVersion() {
54 Element version = getVersionElement();
55 if (version == null) {
56 return null;
57 } else {
58 return version.getTextTrim();
59 }
60 }
61
62 private Element getVersionElement() {
63 return element.getChild("version", element.getNamespace());
64 }
65
66 @Override
67 public void setVersion(String version) {
68 JDomUtils.rewriteValue(getVersionElement(), version);
69 }
70
71 @Override
72 public String getName() {
73 return element.getName();
74 }
75 }