io.annot8.common.implementations.properties.MapMutableProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annot8-common-implementations Show documentation
Show all versions of annot8-common-implementations Show documentation
Common functionality used by Annot8 implementations
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.common.implementations.properties;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import io.annot8.core.properties.MutableProperties;
import io.annot8.core.properties.Properties;
/**
* Implementation of MutableProperties interface using an in-memory HashMap to store the properties.
*/
public class MapMutableProperties implements MutableProperties {
private final Map properties = new HashMap<>();
/** Create a new instance with no key-values */
public MapMutableProperties() {
// Do nothing
}
/** Create a new instance with key-values from an existing Properties object */
public MapMutableProperties(Properties properties) {
properties.getAll().forEach(this.properties::put);
}
/** Create a new instance with key-values from an existing Map */
public MapMutableProperties(Map properties) {
properties.forEach(this.properties::put);
}
@Override
public Map getAll() {
return properties;
}
@Override
public void set(String key, Object value) {
properties.put(key, value);
}
@Override
public Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy