/* * This file is automatically generated. * Do not modify! -- ALL CHANGES WILL BE ERASED! */ package {{packageName}}; import java.util.Date; /** * Provides semantic version information. * * @author Semantic Version * Annotation Processor */ public final class {{className}} { private final static String DEFAULT_PRERELEASE_PREFIX = "-"; private final static String DEFAULT_BUILDMETA_PREFIX = "+"; final static String project = "{{project}}"; final static Date buildDate = new Date({{epoch}}L); final static int major = {{major}}; final static int minor = {{minor}}; final static int patch = {{patch}}; final static String preRelease = "{{preRelease}}"; final static String buildMeta = "{{buildMeta}}"; /** * The full version string. *

* Formatted as: *

* MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA] *
*

* For example: *

*/ final static String version = Integer.toString(major) + '.' + Integer.toString(minor) + '.' + Integer.toString(patch) + preReleaseWithPrefix() + buildMetaWithPrefix(); /** * Disables the default constructor. * * @throws UnsupportedOperationException If the constructor is called. */ private GeneratedVersion() throws UnsupportedOperationException { throw new UnsupportedOperationException("Illegal constructor call."); } /** * Returns the build metadata with default prefix. * * @param prefix The prefix to prepend. * @return The build metadata, if any. */ public static String buildMetaWithPrefix() { return buildMetaWithPrefix(DEFAULT_PRERELEASE_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 && prefix.length() > 0) { return prefix + buildMeta; } else { return buildMeta; } } /** * Returns the pre-release version with default prefix. * * @return The pre-release version, if any. */ public static String preReleaseWithPrefix() { return preReleaseWithPrefix(DEFAULT_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 && prefix.length() > 0) { return prefix + preRelease; } else { return preRelease; } } }