This commit is contained in:
Erik C. Thauvin 2019-04-23 15:47:03 -07:00
parent 06263ee003
commit cd10d5325a
12 changed files with 50 additions and 121 deletions

View file

@ -2,19 +2,20 @@
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package {{packageName}};
import java.util.Date;
public final class {{className}} {
public final static String PROJECT = "{{project}}";
public final static Date BUILDDATE = new Date({{epoch}}L);
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 String VERSION = "{{version}}";
public static final String PROJECT = "{{project}}";
public static final Date BUILDDATE = new Date({{epoch}}L);
public static final int MAJOR = {{major}};
public static final int MINOR = {{minor}};
public static final int PATCH = {{patch}};
public static final String PRERELEASE = "{{preRelease}}";
public static final String BUILDMETA = "{{buildMeta}}";
public static final String VERSION = "{{version}}";
/**
* Disables the default constructor.

View file

@ -6,95 +6,20 @@ package com.example;
import java.util.Date;
/**
* Provides semantic version information.
*
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/
public final class GeneratedVersion {
public final static String PROJECT = "Example";
public final static Date BUILDDATE = new Date(1554108013631L);
public final static String PROJECT = "Java Example";
public final static Date BUILDDATE = new Date(1555703771370L);
public final static int MAJOR = 2;
public final static int MINOR = 0;
public final static int PATCH = 52;
public final static String PRERELEASE = "beta";
public final static String PRERELEASE_PREFIX = "-";
public final static String BUILDMETA = "007";
public final static String BUILDMETA_PREFIX = "+";
public final static String SEPARATOR = "";
/**
* The full version string.
* <p>
* Formatted as:
* <blockquote>
* <code>[MAJOR][SEPARATOR][MINOR][SEPARATOR][PATCH][[PRERELEASE_PREFIX][PRERELEASE]][[BUILDMETA_PREFIX][BUILDMETA]]</code>
* </blockquote>
* <p>
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*/
public final static String VERSION = Integer.toString(MAJOR) + SEPARATOR + Integer.toString(MINOR) + SEPARATOR
+ Integer.toString(PATCH) + preReleaseWithPrefix() + buildMetaWithPrefix();
public final static String VERSION = "2.0.52-beta+007";
/**
* Disables the default constructor.
*
* @throws UnsupportedOperationException If the constructor is called.
*/
private GeneratedVersion()
throws UnsupportedOperationException {
private GeneratedVersion() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
/**
* Returns the build metadata with {@value #BUILDMETA_PREFIX} prefix.
*
* @return The build metadata, if any.
*/
public static String buildMetaWithPrefix() {
return buildMetaWithPrefix(BUILDMETA_PREFIX);
}
/**
* Returns the build metadata.
*
* @param prefix Prefix to prepend.
* @return The build metadata, if any.
*/
public static String buildMetaWithPrefix(final String prefix) {
if (BUILDMETA.length() > 0) {
return prefix + BUILDMETA;
} else {
return BUILDMETA;
}
}
/**
* Returns the pre-release version with {@value #PRERELEASE_PREFIX} prefix.
*
* @return The pre-release version, if any.
*/
public static String preReleaseWithPrefix() {
return preReleaseWithPrefix(PRERELEASE_PREFIX);
}
/**
* Returns the pre-release version.
*
* @param prefix The prefix to prepend.
* @return The pre-release version, if any.
*/
public static String preReleaseWithPrefix(final String prefix) {
if (PRERELEASE.length() > 0) {
return prefix + PRERELEASE;
} else {
return PRERELEASE;
}
}
}