com.sinch.sdk.domains.sms.models.Parameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.sms.models;
import com.sinch.sdk.core.utils.Pair;
import java.util.Collection;
import java.util.HashMap;
import java.util.Optional;
import java.util.stream.Collectors;
public class Parameters extends HashMap {
private static final long serialVersionUID = 1L;
public Parameters(Collection list) {
super(list.stream().collect(Collectors.toMap(entry -> entry.key, entry -> entry)));
}
public static class Entry {
private final String key;
private final Pair value;
private final String defaultValue;
public Entry(String key, Pair value, String defaultValue) {
this.key = key;
this.value = value;
this.defaultValue = defaultValue;
}
public Entry(String key, Pair value) {
this(key, value, null);
}
public String getKey() {
return key;
}
public Pair getValue() {
return value;
}
public Optional getDefaultValue() {
return Optional.ofNullable(defaultValue);
}
@Override
public String toString() {
return "Entry{"
+ "key='"
+ key
+ '\''
+ ", value="
+ value
+ ", defaultValue="
+ defaultValue
+ '}';
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy