protected void bindToProperties() { PropertyUtil.getProperties().forEach(p -> bindToProperty(p)); }
public static void loadDefaults(final Properties properties) { getProperties().forEach(p -> loadDefault(properties, p)); }
public static void loadFromEnvironment(final Properties properties) { getProperties().forEach(p -> loadPropertyFromEnvironment(properties, p)); }
public static void loadFromPropertiesFile(final Properties properties) { try { final Properties tempProperties = new Properties(); URL url = PropertyUtil.class.getResource(APPLICATION_PROPERTIES_FILE_PATH); if (url != null) { tempProperties.load(url.openStream()); getProperties().forEach(p -> loadPropertyFromProperties(tempProperties, properties, p)); } else System.out.println("url is null"); } catch (Exception e) { LOGGER.warn("Error loading properties", e); } }
public static void loadFromSystemProperty(final Properties properties){ getProperties().forEach(p -> loadPropertyFromSystemProperty(properties, p)); }
public static void loadFromCommandLine(final Properties properties, final String[] arguments) { try { final Map<Integer, Option> optionMap = new HashMap<>(); final CommandLineParser parser = new DefaultParser(); final Iterable<Class<? extends GuiceProperty>> guiceProperties = PropertyUtil.getProperties(); final Options options = buildOptions(guiceProperties, optionMap); final CommandLine commandLine = parser.parse(options, arguments); int i = 0; for (final Class<? extends GuiceProperty> guiceProperty : guiceProperties) { setValue(properties, commandLine, optionMap.get(i++), guiceProperty); } } catch (ParseException e) { LOGGER.warn("error parsing CLI options", e); throw (new RuntimeException(e)); } }