com.larksuite.oapi.core.model.OapiHeader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of larksuite-oapi Show documentation
Show all versions of larksuite-oapi Show documentation
Larksuite open platform facilitates the integration of enterprise applications and larksuite, making
collaboration and management more efficient
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;
}
}
}