org.zodiac.sdk.nio.http.common.HttpHeaderCookie Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zodiac-sdk-nio Show documentation
Show all versions of zodiac-sdk-nio Show documentation
Zodiac SDK NIO2(New Non-Blocking IO)
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;
}
}