Package io.github.z4kn4fein.semver.constraints

Types

Link copied to clipboard
class Constraint

This class describes a semantic version constraint. It provides ability to verify whether a version satisfies one or more conditions within a constraint.

Link copied to clipboard
class ConstraintFormatException(message: String) : Exception

Constraint throws this exception when the constraint parsing fails due to an invalid format.

Functions

Link copied to clipboard
infix fun Constraint.satisfiedBy(version: Version): Boolean

Determines whether a Constraint is satisfied by a Version or not.

Link copied to clipboard
infix fun Constraint.satisfiedByAll(versions: Iterable<Version>): Boolean

Determines whether a Constraint is satisfied by each Version in a collection or not.

Link copied to clipboard
infix fun Constraint.satisfiedByAny(versions: Iterable<Version>): Boolean

Determines whether a Constraint is satisfied by at least one Version in a collection or not.

Link copied to clipboard
fun String.toConstraint(): Constraint

Parses the string as a Constraint and returns the result or throws a ConstraintFormatException if the string is not a valid representation of a constraint.

Link copied to clipboard
fun String.toConstraintOrNull(): Constraint?

Parses the string as a Constraint and returns the result or null if the string is not a valid representation of a constraint.