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

org.zodiac.netty.http.headers.AbstractHeader Maven / Gradle / Ivy

The newest version!
package org.zodiac.netty.http.headers;

import java.util.Objects;

import org.zodiac.sdk.toolkit.util.lang.StrUtil;

public abstract class AbstractHeader implements HeaderValueType {

    private final Class type;
    private final CharSequence name;

    protected AbstractHeader(Class type, CharSequence name) {
        this.type = Objects.requireNonNull(type, "type");
        this.name = Objects.requireNonNull(name, "name");
    }

    @Override
    public final CharSequence name() {
        return name;
    }

    @Override
    public final Class type() {
        return type;
    }

    @Override
    public final String toString() {
        return name.toString();
    }

    @Override
    public final boolean equals(Object obj) {
        return obj == null ? false : obj == this ? true : obj instanceof HeaderValueType 
                && StrUtil.equalsCharSeq(name(), ((HeaderValueType) obj).name(), true);
    }

    @Override
    public final int hashCode() {
        return type.hashCode() + (79 * name.hashCode());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy