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