public final class ModuleVersionTool
extends java.lang.Object
ModuleVersionService
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JAVA_SERVICE_TEMPLATE
Service class template.
|
static java.text.SimpleDateFormat |
TIMESTAMP_FORMAT
Format used for timestamp, included in semantic vesion as build string.
|
Modifier and Type | Method and Description |
---|---|
static void |
createJavaImpl(java.lang.String fullClassName,
java.lang.String moduleName,
SemVer version,
java.util.Date releaseDate,
java.io.File srcDir)
Write a Java file which implements this service.
|
static SemVer |
extractFromJavaImpl(java.io.File javaImplFile)
Extract the semantic version from a Java service implementation.
|
static SemVer |
extractFromJavaImpl(java.lang.String fullClassName,
java.io.File srcDir)
Extract the semantic version from a Java service implementation.
|
public static final java.text.SimpleDateFormat TIMESTAMP_FORMAT
public static final java.lang.String JAVA_SERVICE_TEMPLATE
String.format()
, where it expects the following arguments:
package
keyword .public static void createJavaImpl(@NotNull java.lang.String fullClassName, @NotNull java.lang.String moduleName, @NotNull SemVer version, @NotNull java.util.Date releaseDate, @NotNull java.io.File srcDir) throws java.io.IOException
moduleName
and version
as expected.fullClassName
- full class name including packagemoduleName
- name of module, will be returned by ModuleVersionService.getModuleName()
of the created serviceversion
- version of module, will be returned by ModuleVersionService.getModuleVersion()
of the created servicereleaseDate
- release datesrcDir
- root of the source tree, has to be an existing directoryjava.io.IOException
- on write or directory creation arrors@NotNull public static SemVer extractFromJavaImpl(@NotNull java.io.File javaImplFile) throws java.io.IOException
createJavaImpl(String, String, SemVer, Date, File)
, but not necessarily
with other files.javaImplFile
- Java implementation or a module version servicejava.io.IOException
- on read errors or when no version was found@Nullable public static SemVer extractFromJavaImpl(@NotNull java.lang.String fullClassName, @NotNull java.io.File srcDir) throws java.io.IOException
fullClassName
- full class name of the service implementation including packagesrcDir
- root directory of the Java source treenull
if implementation does not existjava.io.IOException
- on read errors or if the file exists but does not contain an extractable version,
compare extractFromJavaImpl(File)