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

io.katharsis.request.path.PathIds Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.katharsis.request.path;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 * Represent an id or ids passed in the path from a client.
 */
public class PathIds {
    public static final String ID_SEPERATOR = ",";

    private final List ids = new LinkedList<>();

    public PathIds(@SuppressWarnings("SameParameterValue") String id) {
        ids.add(id);
    }

    public PathIds(Collection id) {
        ids.addAll(id);
    }

    public List getIds() {
        return ids;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        PathIds pathIds = (PathIds) o;

        return !(ids != null ? !ids.equals(pathIds.ids) : pathIds.ids != null);

    }

    @Override
    public int hashCode() {
        return ids != null ? ids.hashCode() : 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy