diff --git a/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java b/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java new file mode 100644 index 0000000..39082b1 --- /dev/null +++ b/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java @@ -0,0 +1,104 @@ +/* + * This file is automatically generated. + * Do not modify! -- ALL CHANGES WILL BE ERASED! + */ +package net.thauvin.erik.semver.example; + +import java.util.Date; + +/** + * Provides semantic version information. + * + * @author Semantic Version + * Annotation Processor + */ +public final class GeneratedVersion { + private final static String DEFAULT_PRERELEASE_PREFIX = "-"; + private final static String DEFAULT_BUILDMETA_PREFIX = "+"; + + final static String project = "Example"; + final static Date buildDate = new Date(1492727792896L); + final static int major = 2; + final static int minor = 17; + final static int patch = 52; + final static String preRelease = "beta"; + final static String buildMeta = "007"; + + /** + * 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; + } + } +} \ No newline at end of file