View Javadoc
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 java.util.List;
22  
23  import org.apache.maven.model.Dependency;
24  import org.apache.maven.model.Exclusion;
25  import org.apache.maven.shared.release.transform.MavenCoordinate;
26  import org.jdom2.Element;
27  
28  /**
29   * JDOM2 implementation of poms DEPENDENCY element
30   *
31   * @author Robert Scholte
32   * @since 3.0
33   */
34  public class JDomDependency extends Dependency implements MavenCoordinate {
35      private final MavenCoordinate coordinate;
36  
37      /**
38       * <p>Constructor for JDomDependency.</p>
39       *
40       * @param dependency a {@link org.jdom2.Element} object
41       */
42      public JDomDependency(Element dependency) {
43          this.coordinate = new JDomMavenCoordinate(dependency);
44      }
45  
46      @Override
47      public void addExclusion(Exclusion exclusion) {
48          throw new UnsupportedOperationException();
49      }
50  
51      @Override
52      public String getArtifactId() {
53          return coordinate.getArtifactId();
54      }
55  
56      @Override
57      public String getClassifier() {
58          throw new UnsupportedOperationException();
59      }
60  
61      @Override
62      public List<Exclusion> getExclusions() {
63          throw new UnsupportedOperationException();
64      }
65  
66      @Override
67      public String getGroupId() {
68          return coordinate.getGroupId();
69      }
70  
71      @Override
72      public String getScope() {
73          throw new UnsupportedOperationException();
74      }
75  
76      @Override
77      public String getSystemPath() {
78          throw new UnsupportedOperationException();
79      }
80  
81      @Override
82      public String getType() {
83          throw new UnsupportedOperationException();
84      }
85  
86      @Override
87      public String getVersion() {
88          return coordinate.getVersion();
89      }
90  
91      @Override
92      public boolean isOptional() {
93          throw new UnsupportedOperationException();
94      }
95  
96      @Override
97      public void removeExclusion(Exclusion exclusion) {
98          throw new UnsupportedOperationException();
99      }
100 
101     @Override
102     public void setArtifactId(String artifactId) {
103         throw new UnsupportedOperationException();
104     }
105 
106     @Override
107     public void setClassifier(String classifier) {
108         throw new UnsupportedOperationException();
109     }
110 
111     @Override
112     public void setExclusions(List<Exclusion> exclusions) {
113         throw new UnsupportedOperationException();
114     }
115 
116     @Override
117     public void setGroupId(String groupId) {
118         throw new UnsupportedOperationException();
119     }
120 
121     @Override
122     public void setOptional(boolean optional) {
123         throw new UnsupportedOperationException();
124     }
125 
126     @Override
127     public void setScope(String scope) {
128         throw new UnsupportedOperationException();
129     }
130 
131     @Override
132     public void setSystemPath(String systemPath) {
133         throw new UnsupportedOperationException();
134     }
135 
136     @Override
137     public void setType(String type) {
138         throw new UnsupportedOperationException();
139     }
140 
141     @Override
142     public void setVersion(String version) {
143         coordinate.setVersion(version);
144     }
145 
146     @Override
147     public String getName() {
148         return "dependency";
149     }
150 }