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

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

package org.zodiac.netty.http.headers;

import java.util.Objects;

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

final class BooleanHeader extends AbstractHeader {
    
    BooleanHeader(CharSequence name) {
        super(Boolean.TYPE, name);
    }

    @Override
    public String toString(Boolean value) {
        return Objects.requireNonNull(value, "value").toString();
    }

    @Override
    public Boolean toValue(CharSequence value) {
        Objects.requireNonNull(value, "value");
        return StrUtil.equalsCharSeq(StringPool.TRUE, value, true)
                || StrUtil.equalsCharSeq("1", value, false);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy