com.scayle.adminapi.model.ApiOptions Maven / Gradle / Ivy
package com.scayle.adminapi.model;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
public class ApiOptions {
private final Map options;
private ApiOptions(Map options) {
this.options = options;
}
public Map all() {
return this.options;
}
public Map except(List keys) {
Map options = new HashMap();
for (String key : this.options.keySet()) {
if (!keys.contains(key)) {
options.put(key, this.options.get(key));
}
}
return options;
}
public Object get(String key) {
return this.options.get(key);
}
public static ApiOptionsBuilder builder() {
return new ApiOptionsBuilder();
}
public static class ApiOptionsBuilder {
private final Map options;
public ApiOptionsBuilder() {
this.options = new HashMap();
}
public ApiOptionsBuilder addOption(String key, Object value) {
this.options.put(key, value);
return this;
}
public ApiOptions build() {
return new ApiOptions(this.options);
}
}
}