View Javadoc
1   package org.apache.maven.shared.release.transform.jdom2;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.List;
23  
24  import org.apache.maven.model.Dependency;
25  import org.apache.maven.model.Exclusion;
26  import org.apache.maven.shared.release.transform.MavenCoordinate;
27  import org.jdom2.Element;
28  
29  /**
30   * JDOM2 implementation of poms DEPENDENCY element
31   *
32   * @author Robert Scholte
33   * @since 3.0
34   */
35  public class JDomDependency extends Dependency implements MavenCoordinate
36  {
37      private final MavenCoordinate coordinate;
38  
39      /**
40       * <p>Constructor for JDomDependency.</p>
41       *
42       * @param dependency a {@link org.jdom2.Element} object
43       */
44      public JDomDependency( Element dependency )
45      {
46          this.coordinate = new JDomMavenCoordinate( dependency );
47      }
48  
49      @Override
50      public void addExclusion( Exclusion exclusion )
51      {
52          throw new UnsupportedOperationException();
53      }
54  
55      @Override
56      public String getArtifactId()
57      {
58          return coordinate.getArtifactId();
59      }
60  
61      @Override
62      public String getClassifier()
63      {
64          throw new UnsupportedOperationException();
65      }
66  
67      @Override
68      public List<Exclusion> getExclusions()
69      {
70          throw new UnsupportedOperationException();
71      }
72  
73      @Override
74      public String getGroupId()
75      {
76          return coordinate.getGroupId();
77      }
78  
79      @Override
80      public String getScope()
81      {
82          throw new UnsupportedOperationException();
83      }
84  
85      @Override
86      public String getSystemPath()
87      {
88          throw new UnsupportedOperationException();
89      }
90  
91      @Override
92      public String getType()
93      {
94          throw new UnsupportedOperationException();
95      }
96  
97      @Override
98      public String getVersion()
99      {
100         return coordinate.getVersion();
101     }
102 
103     @Override
104     public boolean isOptional()
105     {
106         throw new UnsupportedOperationException();
107     }
108 
109     @Override
110     public void removeExclusion( Exclusion exclusion )
111     {
112         throw new UnsupportedOperationException();
113     }
114 
115     @Override
116     public void setArtifactId( String artifactId )
117     {
118         throw new UnsupportedOperationException();
119     }
120 
121     @Override
122     public void setClassifier( String classifier )
123     {
124         throw new UnsupportedOperationException();
125     }
126 
127     @Override
128     public void setExclusions( List<Exclusion> exclusions )
129     {
130         throw new UnsupportedOperationException();
131     }
132 
133     @Override
134     public void setGroupId( String groupId )
135     {
136         throw new UnsupportedOperationException();
137     }
138 
139     @Override
140     public void setOptional( boolean optional )
141     {
142         throw new UnsupportedOperationException();
143     }
144 
145     @Override
146     public void setScope( String scope )
147     {
148         throw new UnsupportedOperationException();
149     }
150 
151     @Override
152     public void setSystemPath( String systemPath )
153     {
154         throw new UnsupportedOperationException();
155     }
156 
157     @Override
158     public void setType( String type )
159     {
160         throw new UnsupportedOperationException();
161     }
162 
163     @Override
164     public void setVersion( String version )
165     {
166         coordinate.setVersion( version );
167     }
168 
169     @Override
170     public String getName()
171     {
172         return "dependency";
173     }
174 }