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

io.github.chains_project.maven_lockfile.data.VersionNumber Maven / Gradle / Ivy

Go to download

This plugin is a state-of-the-art solution that can be used to validate the integrity of a maven repository. It does this by generating a lock file that contains the checksums of all the artifacts in the repository. The lock file can then be used to validate the integrity of the repository. This guards the supply chain against malicious actors that might tamper with the artifacts in the repository.

There is a newer version: 5.3.5
Show newest version
package io.github.chains_project.maven_lockfile.data;

import com.google.common.base.Strings;
import java.util.Objects;

public class VersionNumber implements Comparable {
    public static VersionNumber of(String versionNumber) {
        String checked = Objects.requireNonNull(versionNumber);
        if (Strings.isNullOrEmpty(checked)) {
            throw new IllegalArgumentException("versionNumber cannot be empty");
        }
        return new VersionNumber(versionNumber);
    }

    private final String value;

    private VersionNumber(String versionNumber) {
        this.value = Objects.requireNonNull(versionNumber, "versionNumber is marked non-null but is null");
    }

    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "{" + " VersionNumber='" + getValue() + "'" + "}";
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof VersionNumber)) {
            return false;
        }
        VersionNumber versionNumber = (VersionNumber) o;
        return Objects.equals(value, versionNumber.value);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(value);
    }

    @Override
    public int compareTo(VersionNumber o) {
        return this.value.compareTo(o.value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy