1 package com.atlassian.plugins.codegen;
2
3 import static com.google.common.base.Preconditions.checkNotNull;
4
5
6
7
8
9 public final class PluginArtifact implements PluginProjectChange
10 {
11
12
13
14 public enum ArtifactType
15 {
16 BUNDLED_ARTIFACT("bundledArtifact"),
17 PLUGIN_ARTIFACT("pluginArtifact");
18
19 private final String elementName;
20
21 private ArtifactType(String elementName)
22 {
23 this.elementName = elementName;
24 }
25
26 public String getElementName()
27 {
28 return elementName;
29 }
30 };
31
32 private final ArtifactType type;
33 private final ArtifactId artifactId;
34 private final VersionId versionId;
35
36 public static PluginArtifact pluginArtifact(ArtifactType type, ArtifactId groupAndArtifactId, VersionId versionId)
37 {
38 return new PluginArtifact(type, groupAndArtifactId, versionId);
39 }
40
41 private PluginArtifact(ArtifactType type, ArtifactId artifactId, VersionId versionId)
42 {
43 this.type = checkNotNull(type, "type");
44 this.artifactId = checkNotNull(artifactId, "artifactId");
45 this.versionId = checkNotNull(versionId, "versionId");
46 }
47
48 public ArtifactType getType()
49 {
50 return type;
51 }
52
53 public ArtifactId getGroupAndArtifactId()
54 {
55 return artifactId;
56 }
57
58 public VersionId getVersionId()
59 {
60 return versionId;
61 }
62
63 @Override
64 public String toString()
65 {
66 return "[" + type.getElementName() + ": " + artifactId + "]";
67 }
68 }