Initial commit.
This commit is contained in:
commit
aeee81544c
27 changed files with 2651 additions and 0 deletions
|
@ -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 net.thauvin.erik.semver.example;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This class provides semantic version information.
|
||||
*
|
||||
* @author Semantic Version Annotation Processor
|
||||
*/
|
||||
public final class GeneratedVersion {
|
||||
private final static String buildmeta = "";
|
||||
private final static Date date = new Date(1453146881481L);
|
||||
private final static int major = 3;
|
||||
private final static int minor = 1;
|
||||
private final static int patch = 35;
|
||||
private final static String prerelease = "beta";
|
||||
|
||||
/**
|
||||
* 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 "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Example.java
|
||||
*
|
||||
* Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.thauvin.erik.semver.example;
|
||||
|
||||
import net.thauvin.erik.semver.Version;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* The <code>Example</code> class.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">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("'Built on' EEE, d MMM yyyy 'at' HH:mm:ss z");
|
||||
|
||||
System.out.println(Example.class.getSimpleName() + ' ' + GeneratedVersion.getVersion());
|
||||
System.out.println(sdf.format(GeneratedVersion.getBuildDate()));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue