commons-version

Set of classes to parse and process version information

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.igormaznitsa
ArtifactId

ArtifactId

commons-version
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

commons-version
Set of classes to parse and process version information
Project URL

Project URL

https://github.com/raydac/commons-version
Project Organization

Project Organization

Igor Maznitsa
Source Code Management

Source Code Management

https://github.com/raydac/commons-version

Download commons-version

How to add to project

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

Dependencies

test (2)

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

Project Modules

There are no modules declared in this project.

License Apache 2.0 Java 6.0+ Maven central PayPal donation Yandex.Money donation

What is it?

it is an auxiliary framework to parse and validate some version information.

How it works?

It has two main classes

Usage of version

Version parsed = new Version("idea-1.04.0015-alpha");
Version fullyFromScratch = new Version("idea",new long[]{1,4,15},"alpha");

Version onlyNumber = new Version(1,4,15);
Version changed = onlyNumber.changePrefix("idea").changePostfix("alpha").changeNumeric(0,1,2);

Usage of version validator

Validator supports AND (,) and OR (;) logical operators, where AND has higher priority.
Allowed conditions:

  • = equals
  • < less
  • > great
  • >= great or equals
  • <= less or equals
  • if there is no any operator then it will be recognized as =
VersionValidator validator = new VersionValidator(">idea-1.1.0,<idea-3.0.2;1.1.0,3.0.2;!=0.0.1-dev");
if (validator.isValid(someVersion)){
  System.out.println("Version valid");
}

Also it is possible to implement own expression parser to parse expressions.
NB! Wrong written conditional operator will be recognized as part of the version prefix! Be careful for typo like =>!

Versions

Version
1.0.0