Package be.business.connector.core.utils
Class PropertyHandler
- java.lang.Object
-
- be.business.connector.core.utils.PropertyHandler
-
public class PropertyHandler extends Object
-
-
Constructor Summary
Constructors Constructor Description PropertyHandler()Instantiates a new property handler.PropertyHandler(String configDir, InputStream stream)PropertyHandler(String configDir, InputStream... inputStreams)PropertyHandler(String propertyfile, String validationFile)PropertyHandler(String propertyfile, String validationFile, String ignored)PropertyHandler(Properties properties)Instantiates a new property handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PropertyHandlercreate(InputStream props, InputStream validationProps, String confDir)booleangetBooleanProperty(String value, String defaultValue)Gets the boolean property.static PropertyHandlergetInstance()Gets the single instance of PropertyHandler.IntegergetIntegerProperty(String string)Gets the integer property.IntegergetIntegerProperty(String string, String defaultValue)Gets the integer property.List<String>getMatchingProperties(String rootKey)Gets the properties that match a root key.PropertiesgetProperties()Gets the properties.PropertiesgetPropertiesCopy()Returns a copy of the current properties.StringgetProperty(String string)Gets the property.StringgetProperty(String string, String defaultValue)Gets the property.URLgetURLProperty(String string)Gets the uRL property.booleanhasProperty(String key)Checks for property.booleanisLog4jInitialized()Checks if is log 4 j initialized.static StringparentPath(String propertyfile)static Pathpath(String propertyfile)voidsetLog4jInitialized(boolean log4jInitialized)Sets the log 4 j initialized.voidsetProperties(Properties properties)Sets the properties.voidsetProperty(String key, String value)Sets the property.static voidwithParentPathGenerator(java8.util.function.Function<Path,String> generator, Runnable task)
-
-
-
Constructor Detail
-
PropertyHandler
public PropertyHandler()
Instantiates a new property handler.
-
PropertyHandler
public PropertyHandler(String configDir, InputStream stream)
-
PropertyHandler
public PropertyHandler(String configDir, InputStream... inputStreams)
-
PropertyHandler
public PropertyHandler(Properties properties)
Instantiates a new property handler.- Parameters:
properties- the properties
-
-
Method Detail
-
getInstance
public static PropertyHandler getInstance()
Gets the single instance of PropertyHandler.- Returns:
- single instance of PropertyHandler
-
create
public static PropertyHandler create(InputStream props, InputStream validationProps, String confDir) throws IOException
- Throws:
IOException
-
withParentPathGenerator
public static void withParentPathGenerator(java8.util.function.Function<Path,String> generator, Runnable task)
-
getProperty
public String getProperty(String string)
Gets the property.- Parameters:
string- the string- Returns:
- the property
-
getIntegerProperty
public Integer getIntegerProperty(String string)
Gets the integer property.- Parameters:
string- the string- Returns:
- the integer property
-
getURLProperty
public URL getURLProperty(String string)
Gets the uRL property.- Parameters:
string- the string- Returns:
- the uRL property
-
getIntegerProperty
public Integer getIntegerProperty(String string, String defaultValue)
Gets the integer property.- Parameters:
string- the stringdefaultValue- the default value- Returns:
- the integer property
-
getProperty
public String getProperty(String string, String defaultValue)
Gets the property.- Parameters:
string- the stringdefaultValue- the default value- Returns:
- the property
-
hasProperty
public boolean hasProperty(String key)
Checks for property.- Parameters:
key- the key- Returns:
- true, if successful
-
getProperties
public Properties getProperties()
Gets the properties.- Returns:
- the properties
-
getPropertiesCopy
public Properties getPropertiesCopy()
Returns a copy of the current properties.- Returns:
- the properties copy
-
getMatchingProperties
public List<String> getMatchingProperties(String rootKey)
Gets the properties that match a root key.- Parameters:
rootKey- the root key- Returns:
- the properties
-
setProperty
public void setProperty(String key, String value)
Sets the property.- Parameters:
key- the keyvalue- the value
-
isLog4jInitialized
public boolean isLog4jInitialized()
Checks if is log 4 j initialized.- Returns:
- true, if is log 4 j initialized
-
setLog4jInitialized
public void setLog4jInitialized(boolean log4jInitialized)
Sets the log 4 j initialized.- Parameters:
log4jInitialized- the new log 4 j initialized
-
setProperties
public void setProperties(Properties properties)
Sets the properties.- Parameters:
properties- the new properties
-
-