Initial commit.

This commit is contained in:
Erik C. Thauvin 2016-01-18 13:22:10 -08:00
commit aeee81544c
27 changed files with 2651 additions and 0 deletions

View file

@ -0,0 +1 @@
net.thauvin.erik.semver.VersionProcessor

View file

@ -0,0 +1,4 @@
runtime.log.logsystem.class = org.apache.velocity.runtime.log.SystemLogChute
resource.loader = file, class
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

View file

@ -0,0 +1,92 @@
/*
* This file is automatically generated by the Semantic Version Annotation Processor.
* Do not modify this file -- YOUR CHANGES WILL BE ERASED!
*/
package ${packageName};
import java.util.Date;
/**
* This class provides semantic version information.
*
* @author Semantic Version Annotation Processor
*/
public final class ${className} {
private final static String buildmeta = "${buildmeta}";
private final static Date date = new Date(${epoch}L);
private final static int major = ${major};
private final static int minor = ${minor};
private final static int patch = ${patch};
private final static String prerelease = "${prerelease}";
/**
* Returns the build date.
*
* @return The build date.
*/
public static Date getBuildDate() {
return date;
}
/**
* Returns the full version.
*
* @return The full version string.
*/
public static String getVersion() {
return "" + getMajor() + '.' + getMinor() + '.' + getPatch() + getPreRelease() + getBuildMetadata();
}
/**
* Returns the major version.
*
* @return The major version.
*/
public static int getMajor() {
return major;
}
/**
* Returns the minor version.
*
* @return The minor version.
*/
public static int getMinor() {
return minor;
}
/**
* Returns the patch version.
*
* @return The patch version.
*/
public static int getPatch() {
return patch;
}
/**
* Returns the pre-release version.
*
* @return The pre-release version, if any.
*/
public static String getPreRelease() {
if (prerelease.length() > 0) {
return '-' + prerelease;
}
return "";
}
/**
* Returns the build metadata.
*
* @return The build metadata, if any.
*/
public static String getBuildMetadata() {
if (buildmeta.length() > 0) {
return '+' + buildmeta;
}
return "";
}
}