1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.shared.release.transform.jdom2;
20
21 import org.apache.maven.model.Extension;
22 import org.apache.maven.shared.release.transform.MavenCoordinate;
23 import org.jdom2.Element;
24
25 /**
26 * JDOM2 implementation of poms EXTENSION element
27 *
28 * @author Robert Scholte
29 * @since 3.0
30 */
31 public class JDomExtension extends Extension implements MavenCoordinate {
32 private final MavenCoordinate coordinate;
33
34 /**
35 * <p>Constructor for JDomExtension.</p>
36 *
37 * @param extension a {@link org.jdom2.Element} object
38 */
39 public JDomExtension(Element extension) {
40 this.coordinate = new JDomMavenCoordinate(extension);
41 }
42
43 @Override
44 public String getArtifactId() {
45 return coordinate.getArtifactId();
46 }
47
48 @Override
49 public String getGroupId() {
50 return coordinate.getGroupId();
51 }
52
53 @Override
54 public String getVersion() {
55 return coordinate.getVersion();
56 }
57
58 @Override
59 public void setArtifactId(String artifactId) {
60 throw new UnsupportedOperationException();
61 }
62
63 @Override
64 public void setGroupId(String groupId) {
65 throw new UnsupportedOperationException();
66 }
67
68 @Override
69 public void setVersion(String version) {
70 coordinate.setVersion(version);
71 }
72
73 @Override
74 public String getName() {
75 return "extension";
76 }
77 }