1 package org.apache.maven.repository.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Map;
24
25 import org.apache.commons.lang3.Validate;
26 import org.eclipse.aether.artifact.AbstractArtifact;
27 import org.eclipse.aether.artifact.Artifact;
28
29
30
31
32 final class RelocatedArtifact
33 extends AbstractArtifact
34 {
35
36 private final Artifact artifact;
37
38 private final String groupId;
39
40 private final String artifactId;
41
42 private final String version;
43
44 public RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
45 {
46 this.artifact = Validate.notNull( artifact, "artifact cannot be null" );
47
48 this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
49 this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
50 this.version = ( version != null && version.length() > 0 ) ? version : null;
51 }
52
53 public String getGroupId()
54 {
55 if ( groupId != null )
56 {
57 return groupId;
58 }
59 else
60 {
61 return artifact.getGroupId();
62 }
63 }
64
65 public String getArtifactId()
66 {
67 if ( artifactId != null )
68 {
69 return artifactId;
70 }
71 else
72 {
73 return artifact.getArtifactId();
74 }
75 }
76
77 public String getVersion()
78 {
79 if ( version != null )
80 {
81 return version;
82 }
83 else
84 {
85 return artifact.getVersion();
86 }
87 }
88
89 public String getClassifier()
90 {
91 return artifact.getClassifier();
92 }
93
94 public String getExtension()
95 {
96 return artifact.getExtension();
97 }
98
99 public File getFile()
100 {
101 return artifact.getFile();
102 }
103
104 public String getProperty( String key, String defaultValue )
105 {
106 return artifact.getProperty( key, defaultValue );
107 }
108
109 public Map<String, String> getProperties()
110 {
111 return artifact.getProperties();
112 }
113
114 }