XELLITIX Commons - Semantic Versioning

Semantic Versioning Models and Utilities

License

License

GroupId

GroupId

com.xellitix.commons
ArtifactId

ArtifactId

semver
Last Version

Last Version

0.6.0
Release Date

Release Date

Type

Type

jar
Description

Description

XELLITIX Commons - Semantic Versioning
Semantic Versioning Models and Utilities
Project URL

Project URL

http://xellitix.com/semver/
Source Code Management

Source Code Management

https://github.com/Xellitix/commons-semver

Download semver

How to add to project

<!-- https://jarcasting.com/artifacts/com.xellitix.commons/semver/ -->
<dependency>
    <groupId>com.xellitix.commons</groupId>
    <artifactId>semver</artifactId>
    <version>0.6.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.xellitix.commons/semver/
implementation 'com.xellitix.commons:semver:0.6.0'
// https://jarcasting.com/artifacts/com.xellitix.commons/semver/
implementation ("com.xellitix.commons:semver:0.6.0")
'com.xellitix.commons:semver:jar:0.6.0'
<dependency org="com.xellitix.commons" name="semver" rev="0.6.0">
  <artifact name="semver" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.xellitix.commons', module='semver', version='0.6.0')
)
libraryDependencies += "com.xellitix.commons" % "semver" % "0.6.0"
[com.xellitix.commons/semver "0.6.0"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.inject : guice jar 4.2.2
com.google.inject.extensions : guice-assistedinject jar 4.2.2
com.google.code.findbugs : jsr305 jar 3.0.2

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.19
org.assertj : assertj-core jar 3.11.1

Project Modules

There are no modules declared in this project.

XELLITIX Commons - Semantic Versioning

Semantic versioning Java library.

Usage

Parsing a Semantic Version

// Create the Google Guice injector
Injector injector = Guice.createInjector(new SemanticVersionModule());

// Create the version parser
SemanticVersionParser parser = injector.getInstance(SemanticVersionParser.class);

// Parse the version
SemanticVersion version = parser.parse("1.0.0-rc.1+x86-64.2");

// Get the version properties
version.getMajorVersion()       // int                : 1
version.getMinorVersion()       // int                : 0
version.getPatchVersion()       // int                : 0
version.getPreReleaseMetadata() // Optional<Metadata> : "rc.1"
version.getBuildMetadata()      // Optional<Metadata> : "x86-64.2"

Building a Semantic Version

// Create the Google Guice injector
Injector injector = Guice.createInjector(new SemanticVersionModule());

// Create the version builder
SemanticVersionBuilder builder = injector.getInstance(SemanticVersionBuilder.class);

// Build the Semantic Version
SemanticVersion version = builder
    .setMajorVersion(1)
    .addPreReleaseMetadataIdentifier("rc")
    .addPreReleaseMetadataIdentifier(1)
    .addBuildMetadataIdentifier("arm32")
    .addBuildMetadataIdentifier(54L)
    .build();

// Get the string representation of the version
version.toString(); // "1.0.0-rc.1+arm32.54";

Style

This project aims to adhere to the Google Java Style Guide.

Versioning

This project aims to adhere to Semantic Versioning 2.0.0.

Authors

com.xellitix.commons

XELLITIX

XELLITIX Open Source Software

Versions

Version
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0