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

com.larksuite.oapi.core.model.OapiHeader Maven / Gradle / Ivy

Go to download

Larksuite open platform facilitates the integration of enterprise applications and larksuite, making collaboration and management more efficient

There is a newer version: 1.0.18-rc8
Show newest version
package com.larksuite.oapi.core.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class OapiHeader {

    private final Map> m = new HashMap<>();

    public OapiHeader(Map> headers) {
        for (Map.Entry> entry : headers.entrySet()) {
            this.m.put(normalizeKey(entry.getKey()), entry.getValue());
        }
    }

    private static String normalizeKey(String name) {
        return name != null ? name.toLowerCase() : null;
    }

    public Set getNames() {
        return m.keySet();
    }

    public List getMultiValues(String name) {
        return this.m.get(normalizeKey(name));
    }

    public String getFirstValue(String name) {
        List values = this.m.get(normalizeKey(name));
        if (values != null && values.size() > 0) {
            return values.get(0);
        } else {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy