All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lowagie.text.utils.SystemPropertyUtil Maven / Gradle / Ivy

There is a newer version: 1.3.27-jsign3
Show newest version
package com.lowagie.text.utils;

public class SystemPropertyUtil {
	/**
	 * Similar to {@link Boolean#getBoolean(String)} but uses the given default value if property were not set.
	 * @param propertyKey the system property key
	 * @param defaultValue the default value to use if property is not defined.
	 * @return true if the property is defined and contains "true" (ignoring case), else if system property is not set then the provided defaultValue, else false.
	 */
	public static boolean getBoolean(String propertyKey, boolean defaultValue) {
		String propertyValue = System.getProperty(propertyKey);
		if(propertyValue == null) {
			return defaultValue;
		}
		
		return Boolean.parseBoolean(propertyValue);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy