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

org.zodiac.sdk.nio.http.common.HttpHeaderCookie Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.sdk.nio.http.common;

import org.zodiac.sdk.util.StringUtil;

public class HttpHeaderCookie {

    private final String name;

    private final String value;

    public HttpHeaderCookie(String name, String value) {
        if (StringUtil.isBlank(name)) {
            throw new IllegalArgumentException("'name' is required and must not be empty.");
        }
        this.name = name;
        this.value = (value != null ? value : "");
    }

    public String getName() {
        return this.name;
    }

    public String getValue() {
        return this.value;
    }

    @Override
    public int hashCode() {
        return this.name.hashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof HttpHeaderCookie)) {
            return false;
        }
        HttpHeaderCookie otherCookie = (HttpHeaderCookie) other;
        return (this.name.equalsIgnoreCase(otherCookie.getName()));
    }

    @Override
    public String toString() {
        return this.name + '=' + this.value;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy