Top Description Constructors Methods
io.smallrye.common.version

public abstract Class AbstractVersionScheme<I extends AbstractVersionIterator>

extends Object
implements VersionScheme
Class Inheritance
All Implemented Interfaces
io.smallrye.common.version.VersionScheme, java.util.Comparator
Known Direct Subclasses
io.smallrye.common.version.BasicVersionScheme, io.smallrye.common.version.JpmsVersionScheme, io.smallrye.common.version.MavenVersionScheme
Type Parameters
<I>
the iterator type

A version scheme base class that provides basic comparison functionality.

Constructor Summary

AccessConstructor and Description
protected
AbstractVersionScheme()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public StringBuilder
appendCanonicalized(final StringBuilder
the string builder to append to (must not be null)
target
,
final String
the possibly non-canonical version (must not be null)
original
)

Implements io.smallrye.common.version.VersionScheme.appendCanonicalized.

Append the canonical representation of this version to the given builder, according to the current version scheme.

public int
compare(final String
the first version (must not be null)
v1
,
final String
the second version (must not be null)
v2
)

Implements io.smallrye.common.version.VersionScheme.compare.

Compare two versions according to this version scheme.

protected abstract int

Returns:

-1, 0, or 1 if the first version is less than, equal to, or greater than the second version
compare
(I
the iterator for the first version (must not be null)
i1
,
I
the iterator for the second version (must not be null)
i2
)

Redeclares java.util.Comparator.compare.

Compare the current tokens of the two given iterators.

protected int

Returns:

-1, 0, or 1 if the first version is less than, equal to, or greater than the second version
compareNext
(I
the iterator for the first version (must not be null)
i1
,
I
the iterator for the second version (must not be null)
i2
)

Compare the next elements of the given iterators.

protected int

Returns:

-1, 0, or 1 if the first version is less than, equal to, or greater than zero
compareZero
(I
the version iterator (must not be null)
i
)

Compare the given version iterator against zero.

public abstract I
iterate(final String
the version to iterate (must not be null)
version
)

Redeclares io.smallrye.common.version.VersionScheme.iterate.

Iterate the canonicalized components of the given version according to the rules of this versioning scheme.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractVersionSchemeback to summary
protected AbstractVersionScheme()

Construct a new instance.

Method Detail

appendCanonicalizedback to summary
public StringBuilder appendCanonicalized(final StringBuilder target, final String original)

Implements io.smallrye.common.version.VersionScheme.appendCanonicalized.

Doc from io.smallrye.common.version.VersionScheme.appendCanonicalized.

Append the canonical representation of this version to the given builder, according to the current version scheme.

Parameters
target:StringBuilder

the string builder to append to (must not be null)

original:String

the possibly non-canonical version (must not be null)

Returns:StringBuilder

the string builder that was passed in

compareback to summary
public int compare(final String v1, final String v2)

Implements io.smallrye.common.version.VersionScheme.compare.

Doc from io.smallrye.common.version.VersionScheme.compare.

Compare two versions according to this version scheme.

Parameters
v1:String

the first version (must not be null)

v2:String

the second version (must not be null)

Returns:int

-1, 0, or 1 if the first version is less than, equal to, or greater than the second version according to this version scheme

compareback to summary
protected abstract int compare(I i1, I i2)

Redeclares java.util.Comparator.compare.

Compare the current tokens of the two given iterators. If the tokens are equal, then this method should recurse to compareNext(I, I) (or equivalent) to compare the next tokens.

Parameters
i1:I

the iterator for the first version (must not be null)

i2:I

the iterator for the second version (must not be null)

Returns:int

-1, 0, or 1 if the first version is less than, equal to, or greater than the second version

compareNextback to summary
protected int compareNext(I i1, I i2)

Compare the next elements of the given iterators. If one iterator is at the end of iteration (its iterator reports no next element), the corresponding version is considered to come before the other version. If both iterators are at the end of iteration, the versions are considered equal. Otherwise, compare(I, I) is called to compare the iterators' current tokens.

Parameters
i1:I

the iterator for the first version (must not be null)

i2:I

the iterator for the second version (must not be null)

Returns:int

-1, 0, or 1 if the first version is less than, equal to, or greater than the second version

compareZeroback to summary
protected int compareZero(I i)

Compare the given version iterator against zero. The default implementation assumes that any non-empty version comes after zero.

Parameters
i:I

the version iterator (must not be null)

Returns:int

-1, 0, or 1 if the first version is less than, equal to, or greater than zero

iterateback to summary
public abstract I iterate(final String version)

Redeclares io.smallrye.common.version.VersionScheme.iterate.

Doc from io.smallrye.common.version.VersionScheme.iterate.

Iterate the canonicalized components of the given version according to the rules of this versioning scheme.

Parameters
version:String

the version to iterate (must not be null)

Returns:I

the version iterator (not null)