Code format, tabs to spaces, etc.
This commit is contained in:
parent
3973b144bc
commit
240c928e77
16 changed files with 826 additions and 667 deletions
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* 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 <a href="https://github.com/ethauvin/semver">Semantic Version
|
||||
* Annotation Processor</a>
|
||||
*/
|
||||
public final class GeneratedVersion {
|
||||
private final static String buildmeta = "";
|
||||
private final static Date date = new Date(1468888435317L);
|
||||
private final static int major = 3;
|
||||
private final static int minor = 1;
|
||||
private final static int patch = 49;
|
||||
private final static String prerelease = "beta";
|
||||
private final static String project = "Example";
|
||||
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*
|
||||
* @throws UnsupportedOperationException If the constructor is called.
|
||||
*/
|
||||
private GeneratedVersion()
|
||||
throws UnsupportedOperationException {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the build date.
|
||||
*
|
||||
* @return The build date.
|
||||
*/
|
||||
public static Date getBuildDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the project name.
|
||||
*
|
||||
* @return The project name, if any.
|
||||
*/
|
||||
public static String getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full version string.
|
||||
* <p>
|
||||
* Formatted as:
|
||||
* <blockquote>
|
||||
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</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>
|
||||
*
|
||||
* @return The version string.
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return Integer.toString(getMajor()) + '.'
|
||||
+ Integer.toString(getMinor()) + '.'
|
||||
+ Integer.toString(getPatch())
|
||||
+ getPreRelease(true) + getBuildMetadata(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param isHyphen Prepend a hyphen, if <code>true</code>.
|
||||
* @return The pre-release version, if any.
|
||||
*/
|
||||
public static String getPreRelease(final boolean isHyphen) {
|
||||
if (prerelease.length() > 0) {
|
||||
if (isHyphen) {
|
||||
return '-' + prerelease;
|
||||
} else {
|
||||
return prerelease;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-release version.
|
||||
*
|
||||
* @return The pre-release version, if any.
|
||||
*/
|
||||
public static String getPreRelease() {
|
||||
return getPreRelease(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the build metadata.
|
||||
*
|
||||
* @param isPlus Prepend a plus sign, if <code>true</code>.
|
||||
* @return The build metadata, if any.
|
||||
*/
|
||||
public static String getBuildMetadata(final boolean isPlus) {
|
||||
if (buildmeta.length() > 0) {
|
||||
if (isPlus) {
|
||||
return '+' + buildmeta;
|
||||
} else {
|
||||
return buildmeta;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the build metadata.
|
||||
*
|
||||
* @return The build metadata, if any.
|
||||
*/
|
||||
public static String getBuildMetadata() {
|
||||
return getBuildMetadata(false);
|
||||
}
|
||||
}
|
|
@ -38,28 +38,26 @@ import java.text.SimpleDateFormat;
|
|||
/**
|
||||
* The <code>Example</code> class.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @created 2016-01-13
|
||||
* @since 1.0
|
||||
*/
|
||||
@Version(properties = "version.properties")
|
||||
public class Example
|
||||
{
|
||||
public static void main(final String... args)
|
||||
{
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
||||
public class Example {
|
||||
public static void main(final String... args) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
System.out.println("-----------------------------------------------------");
|
||||
|
||||
System.out.println(" " + GeneratedVersion.getProject() + ' ' + GeneratedVersion.getVersion());
|
||||
System.out.println(" " + GeneratedVersion.getProject() + ' ' + GeneratedVersion.getVersion());
|
||||
|
||||
System.out.println(" Built on: " + sdf.format(GeneratedVersion.getBuildDate()));
|
||||
System.out.println(" Major: " + GeneratedVersion.getMajor());
|
||||
System.out.println(" Minor: " + GeneratedVersion.getMinor());
|
||||
System.out.println(" Patch: " + GeneratedVersion.getPatch());
|
||||
System.out.println(" PreRelease: " + GeneratedVersion.getPreRelease());
|
||||
System.out.println(" BuildMetaData: " + GeneratedVersion.getBuildMetadata());
|
||||
System.out.println(" Built on: " + sdf.format(GeneratedVersion.getBuildDate()));
|
||||
System.out.println(" Major: " + GeneratedVersion.getMajor());
|
||||
System.out.println(" Minor: " + GeneratedVersion.getMinor());
|
||||
System.out.println(" Patch: " + GeneratedVersion.getPatch());
|
||||
System.out.println(" PreRelease: " + GeneratedVersion.getPreRelease());
|
||||
System.out.println(" BuildMetaData: " + GeneratedVersion.getBuildMetadata());
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue