1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.artifact.handler;
20
21 import static java.util.Objects.requireNonNull;
22
23
24
25
26
27 public class DefaultArtifactHandler implements ArtifactHandler {
28 private final String type;
29
30 private String extension;
31
32 private String classifier;
33
34 private String directory;
35
36 private String packaging;
37
38 private boolean includesDependencies;
39
40 private String language;
41
42 private boolean addedToClasspath;
43
44
45
46
47
48
49
50 @Deprecated
51 public DefaultArtifactHandler() {
52 this.type = null;
53 }
54
55 public DefaultArtifactHandler(final String type) {
56 this(type, null, null, null, null, false, null, false);
57 }
58
59 @SuppressWarnings("checkstyle:ParameterNumber")
60 public DefaultArtifactHandler(
61 final String type,
62 final String extension,
63 final String classifier,
64 final String directory,
65 final String packaging,
66 final boolean includesDependencies,
67 final String language,
68 final boolean addedToClasspath) {
69 this.type = requireNonNull(type);
70 this.extension = extension;
71 this.classifier = classifier;
72 this.directory = directory;
73 this.packaging = packaging;
74 this.includesDependencies = includesDependencies;
75 this.language = language;
76 this.addedToClasspath = addedToClasspath;
77 }
78
79 public String getType() {
80 return type;
81 }
82
83 @Override
84 public String getExtension() {
85 if (extension == null) {
86 return type;
87 }
88 return extension;
89 }
90
91 public void setExtension(final String extension) {
92 this.extension = extension;
93 }
94
95 @Override
96 public String getClassifier() {
97 return classifier;
98 }
99
100 public void setClassifier(final String classifier) {
101 this.classifier = classifier;
102 }
103
104 @Override
105 public String getDirectory() {
106 if (directory == null) {
107 return getPackaging() + "s";
108 }
109 return directory;
110 }
111
112 public void setDirectory(final String directory) {
113 this.directory = directory;
114 }
115
116 @Override
117 public String getPackaging() {
118 if (packaging == null) {
119 return type;
120 }
121 return packaging;
122 }
123
124 public void setPackaging(final String packaging) {
125 this.packaging = packaging;
126 }
127
128 @Override
129 public boolean isIncludesDependencies() {
130 return includesDependencies;
131 }
132
133 public void setIncludesDependencies(final boolean includesDependencies) {
134 this.includesDependencies = includesDependencies;
135 }
136
137 @Override
138 public String getLanguage() {
139 if (language == null) {
140 return "none";
141 }
142
143 return language;
144 }
145
146 public void setLanguage(final String language) {
147 this.language = language;
148 }
149
150 @Override
151 public boolean isAddedToClasspath() {
152 return addedToClasspath;
153 }
154
155 public void setAddedToClasspath(final boolean addedToClasspath) {
156 this.addedToClasspath = addedToClasspath;
157 }
158 }