com.tngtech.configbuilder.annotation.propertyloaderconfiguration.PropertyLocationsProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of config-builder Show documentation
Show all versions of config-builder Show documentation
The Config Builder creates fully configured instances of config classes, using values from various sources like properties files, command line arguments etc.
package com.tngtech.configbuilder.annotation.propertyloaderconfiguration;
import com.tngtech.propertyloader.PropertyLoader;
import java.lang.annotation.Annotation;
public class PropertyLocationsProcessor implements PropertyLoaderConfigurationProcessor {
public void configurePropertyLoader(Annotation annotation, PropertyLoader propertyLoader) {
propertyLoader.getLocations().clear();
String[] locations = ((PropertyLocations) annotation).directories();
for (String location : locations) {
propertyLoader.atDirectory(location);
}
Class[] classes = ((PropertyLocations) annotation).resourcesForClasses();
for (Class clazz : classes) {
propertyLoader.atRelativeToClass(clazz);
}
if (((PropertyLocations) annotation).fromClassLoader()) {
propertyLoader.atContextClassPath();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy