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

restx.endpoint.Endpoint Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package restx.endpoint;

import java.util.Objects;

/**
 * Created by fcamblor on 07/02/15.
 */
public class Endpoint {
    private final String method;
    private final String pathPattern;

    public Endpoint(String method, String pathPattern) {
        this.pathPattern = pathPattern;
        this.method = method;
    }

    public String getMethod() {
        return method;
    }

    public String getPathPattern() {
        return pathPattern;
    }

    public static Endpoint of(String method, String pathPattern) {
        return new Endpoint(method, pathPattern);
    }

    @Override
    public String toString() {
        return method + " " + pathPattern;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Endpoint)) return false;
        Endpoint endpoint = (Endpoint) o;
        return Objects.equals(method, endpoint.method) &&
                Objects.equals(pathPattern, endpoint.pathPattern);
    }

    @Override
    public int hashCode() {
        return Objects.hash(method, pathPattern);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy