package com.lutao.cloud.iot.mqtt.core.server.http.handler;

import org.tio.http.common.Method;

import java.util.Objects;

/**
 * Handler info
 */
public class HandlerInfo {
    private final Method method;
    private final HttpHandler handler;

    public HandlerInfo(Method method, HttpHandler handler) {
        this.method = method;
        this.handler = handler;
    }

    public Method getMethod() {
        return method;
    }

    public HttpHandler getHandler() {
        return handler;
    }

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

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