Skip to content

Commit 54fe62b

Browse files
committed
Add base class for creating modular JAR files.
1 parent 38e2880 commit 54fe62b

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
*
3+
* Copyright 2018 The Apache Software Foundation
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.codehaus.plexus.archiver.jar;
18+
19+
/**
20+
* Base class for creating modular JAR archives.
21+
*
22+
* Subclasses are required to be able to handle both
23+
* JAR archives with module descriptor (modular JAR)
24+
* and without ("regular" JAR).
25+
* That would allow clients of this class to use
26+
* it without prior knowledge if the classes
27+
* they are going to add are part of module
28+
* (contain module descriptor class) or not.
29+
*
30+
* @since 3.6
31+
*/
32+
public abstract class ModularJarArchiver
33+
extends JarArchiver
34+
{
35+
private String moduleMainClass;
36+
37+
private String moduleVersion;
38+
39+
public String getModuleMainClass()
40+
{
41+
return moduleMainClass;
42+
}
43+
44+
/**
45+
* Sets the module main class.
46+
* Ignored if the JAR file does not contain
47+
* module descriptor.
48+
*
49+
* <p>Note that implementations may choose
50+
* to replace the value set in the manifest as well.
51+
*
52+
* @param moduleMainClass the module main class.
53+
*/
54+
public void setModuleMainClass( String moduleMainClass )
55+
{
56+
this.moduleMainClass = moduleMainClass;
57+
}
58+
59+
public String getModuleVersion()
60+
{
61+
return moduleVersion;
62+
}
63+
64+
/**
65+
* Sets the module version.
66+
* Ignored if the JAR file does not contain
67+
* module descriptor.
68+
*
69+
* @param moduleVersion the module version.
70+
*/
71+
public void setModuleVersion( String moduleVersion )
72+
{
73+
this.moduleVersion = moduleVersion;
74+
}
75+
76+
}

0 commit comments

Comments
 (0)