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

io.github.chains_project.maven_lockfile.data.GroupId 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.

The newest version!
package io.github.chains_project.maven_lockfile.data;

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

public class GroupId implements Comparable {

    /**
     * Creates a new GroupId from a string. The string must not be null or empty.
     * @param groupId  the string to create the GroupId from
     * @return  the new GroupId
     */
    public static GroupId of(String groupId) {
        String checked = Objects.requireNonNull(groupId);
        if (Strings.isNullOrEmpty(checked)) {
            throw new IllegalArgumentException("groupId cannot be empty");
        }
        return new GroupId(groupId);
    }

    private final String value;

    private GroupId(String groupId) {
        this.value = groupId;
    }

    public String getValue() {
        return value;
    }

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy