![JAR search and dependency download from the Maven repository](/logo.png)
com.github.peterbecker.configuration.storage.PropertiesStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of configuration-parser Show documentation
Show all versions of configuration-parser Show documentation
Parser and command line handling for configuration.
package com.github.peterbecker.configuration.storage;
import lombok.Data;
import lombok.NonNull;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
/**
* A Store implemented through a Properties object.
*/
@Data
public class PropertiesStore implements Store {
private final
@NonNull
Properties properties;
@Override
public Optional getValue(Key key) {
String propKey;
if (key.getContext().isEmpty()) {
propKey = key.getOptionName();
} else {
propKey = key.getContext().stream().collect(Collectors.joining(".")) +
"." +
key.getOptionName();
}
return Optional.ofNullable(properties.getProperty(propKey));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy