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

de.SweetCode.SteamAPI.method.input.Input Maven / Gradle / Ivy

There is a newer version: 1.0.4-beta
Show newest version
package de.SweetCode.SteamAPI.method.input;

import java.util.HashMap;
import java.util.Map;

/**
 * 

* This class keeps just the data which will be passed to the Steam API. *

*/ public class Input { public Map values = new HashMap<>(); public Input() {} /** *

* Adds a new value to the input. *

* * @param key The key of the input. * @param value The value of the input. * * @param the type of the value */ public void add(String key, T value) { this.values.put(key, value); } /** *

* All currently stored values. *

* * @return A map of inputs, never null, can be empty if no values have been added. */ public Map getValues() { return this.values; } /** *

* Checks if the input contains a specific key. *

* * @param key The key to check. * @return True, if the input contains the key, ohterwise false. */ public boolean contains(String key) { return this.values.containsKey(key); } /** *

* Creates an instance of an empty Input. *

* * @return The empty Input instance. */ public static Input empty() { return Input.create().build(); } public static Builder create() { return new Builder(); } public static class Builder { public Map values = new HashMap<>(); public Builder() {} public Builder add(String key, T value) { this.values.put(key, value); return this; } public Input build() { Input input = new Input(); this.values.forEach(input::add); return input; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy