All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.artipie.nuget.metadata.Version Maven / Gradle / Ivy

There is a newer version: 1.5.5
Show newest version
/*
 * The MIT License (MIT) Copyright (c) 2020-2023 artipie.com
 * https://github.com/artipie/artipie/blob/master/LICENSE.txt
 */

package com.artipie.nuget.metadata;

import java.util.Comparator;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Version of package.
 * See Package versioning.
 * See Normalized version numbers.
 * Comparison of version strings is implemented using SemVer 2.0.0's version precedence rules.
 *
 * @since 0.1
 */
@SuppressWarnings("PMD.TooManyMethods")
public final class Version implements Comparable, NuspecField {

    /**
     * RegEx pattern for matching version string.
     *
     */
    private static final Pattern PATTERN = Pattern.compile(
        String.join(
            "",
            "(?\\d+)\\.(?\\d+)",
            "(\\.(?\\d+)(\\.(?\\d+))?)?",
            "(-(?




© 2015 - 2025 Weber Informatics LLC | Privacy Policy