com.github.tonivade.resp.StateHolder Maven / Gradle / Ivy
/*
* Copyright (c) 2015-2018, Antonio Gabriel Muñoz Conejo
* Distributed under the terms of the MIT License
*/
package com.github.tonivade.resp;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public class StateHolder {
private final Map state = new HashMap<>();
@SuppressWarnings("unchecked")
public Optional getValue(String key) {
return (Optional) Optional.ofNullable(state.get(key));
}
@SuppressWarnings("unchecked")
public Optional removeValue(String key) {
return (Optional) Optional.ofNullable(state.remove(key));
}
public void putValue(String key, Object value) {
state.put(key, value);
}
public void clear() {
state.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy