Updated to new semver template format.
This commit is contained in:
parent
bc985dbed4
commit
a45a514542
4 changed files with 53 additions and 53 deletions
|
@ -13,19 +13,19 @@ import java.time.*;
|
|||
* Annotation Processor</a>
|
||||
*/
|
||||
public final class {{className}} {
|
||||
private final static String DEFAULT_PRERELEASE_PREFIX = "-";
|
||||
private final static String DEFAULT_BUILDMETA_PREFIX = "+";
|
||||
public final static String PRERELEASE_PREFIX = "-";
|
||||
public final static String BUILDMETA_PREFIX = "+";
|
||||
|
||||
public final static String project = "{{project}}";
|
||||
public final static LocalDateTime buildDate =
|
||||
public final static String PROJECT = "{{project}}";
|
||||
public final static LocalDateTime BUILDDATE =
|
||||
LocalDateTime.ofInstant(Instant.ofEpochMilli({{epoch}}L), ZoneId.systemDefault());
|
||||
public final static int major = {{major}};
|
||||
public final static int minor = {{minor}};
|
||||
public final static int patch = {{patch}};
|
||||
public final static String preRelease = "{{preRelease}}";
|
||||
public final static String buildMeta = "{{buildMeta}}";
|
||||
public final static int MAJOR = {{major}};
|
||||
public final static int MINOR = {{minor}};
|
||||
public final static int PATCH = {{patch}};
|
||||
public final static String PRERELEASE = "{{preRelease}}";
|
||||
public final static String BUILDMETA = "{{buildMeta}}";
|
||||
|
||||
/**
|
||||
/**
|
||||
* The full version string.
|
||||
* <p>
|
||||
* Formatted as:
|
||||
|
@ -41,9 +41,9 @@ public final class {{className}} {
|
|||
* <li><code>1.0.0-alpha+001</code></li>
|
||||
* </ul>
|
||||
*/
|
||||
public final static String version = Integer.toString(major) + '.'
|
||||
+ Integer.toString(minor) + '.'
|
||||
+ Integer.toString(patch)
|
||||
public final static String VERSION = Integer.toString(MAJOR) + '.'
|
||||
+ Integer.toString(MINOR) + '.'
|
||||
+ Integer.toString(PATCH)
|
||||
+ preReleaseWithPrefix() + buildMetaWithPrefix();
|
||||
|
||||
/**
|
||||
|
@ -57,12 +57,12 @@ public final class {{className}} {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the build metadata with default prefix.
|
||||
* Returns the build metadata with {@value #BUILDMETA_PREFIX} prefix.
|
||||
*
|
||||
* @return The build metadata, if any.
|
||||
*/
|
||||
public static String buildMetaWithPrefix() {
|
||||
return buildMetaWithPrefix(DEFAULT_PRERELEASE_PREFIX);
|
||||
return buildMetaWithPrefix(BUILDMETA_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,20 +72,20 @@ public final class {{className}} {
|
|||
* @return The build metadata, if any.
|
||||
*/
|
||||
public static String buildMetaWithPrefix(final String prefix) {
|
||||
if (buildMeta.length() > 0 && prefix.length() > 0) {
|
||||
return prefix + buildMeta;
|
||||
if (BUILDMETA.length() > 0 && prefix.length() > 0) {
|
||||
return prefix + BUILDMETA;
|
||||
} else {
|
||||
return buildMeta;
|
||||
return BUILDMETA;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-release version with default prefix.
|
||||
* Returns the pre-release version with {@value #PRERELEASE_PREFIX} prefix.
|
||||
*
|
||||
* @return The pre-release version, if any.
|
||||
*/
|
||||
public static String preReleaseWithPrefix() {
|
||||
return preReleaseWithPrefix(DEFAULT_PRERELEASE_PREFIX);
|
||||
return preReleaseWithPrefix(PRERELEASE_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,10 +95,10 @@ public final class {{className}} {
|
|||
* @return The pre-release version, if any.
|
||||
*/
|
||||
public static String preReleaseWithPrefix(final String prefix) {
|
||||
if (preRelease.length() > 0 && prefix.length() > 0) {
|
||||
return prefix + preRelease;
|
||||
if (PRERELEASE.length() > 0 && prefix.length() > 0) {
|
||||
return prefix + PRERELEASE;
|
||||
} else {
|
||||
return preRelease;
|
||||
return PRERELEASE;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue