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

com.scayle.adminapi.model.ApiOptions Maven / Gradle / Ivy

There is a newer version: 1.24.0
Show newest version
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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy