![JAR search and dependency download from the Maven repository](/logo.png)
de.felixroske.jfxsupport.PropertyReaderHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springboot-javafx-support Show documentation
Show all versions of springboot-javafx-support Show documentation
Support for Spring Boot and JavaFX 8
package de.felixroske.jfxsupport;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import org.springframework.core.env.Environment;
public class PropertyReaderHelper {
public static List get(Environment env, String propName) {
ArrayList list = new ArrayList<>();
String singleProp = env.getProperty(propName);
if(singleProp != null) {
list.add(singleProp);
return list;
}
int counter = 0;
String prop = env.getProperty(propName + "[" + counter + "]");
while (prop != null) {
list.add(prop);
counter++;
prop = env.getProperty(propName + "[" + counter + "]");
}
return list;
}
public static void setIfPresent(Environment env, String key, Class type, Consumer function) {
T value = env.getProperty(key,type);
if(value != null) {
function.accept(value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy