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

colesico.framework.http.HttpValues Maven / Gradle / Ivy

/*
 * Copyright © 2014-2020 Vladlen V. Larionov and others as noted.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package colesico.framework.http;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * @author Vladlen Larionov
 */
public final class HttpValues   {

    private final Map> valuesMap;

    public HttpValues(Map> valuesMap) {
        this.valuesMap = valuesMap;
    }

    public V get(Object key) {
        MultiValue multiValue = valuesMap.get(key);
        if (multiValue == null) {
            return null;
        }
        return multiValue.value();
    }

    public Set getKeys(){
        return Collections.unmodifiableSet(valuesMap.keySet());
    }

    public MultiValue getAll(Object key){
        return valuesMap.get(key);
    }

    public int size(){
        return valuesMap.size();
    }

    public boolean isEmpty(){
        return valuesMap.isEmpty();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy