Package ej.property.loader
Class CompositePropertyLoader
- java.lang.Object
-
- ej.property.loader.CompositePropertyLoader
-
- All Implemented Interfaces:
PropertyLoader
public class CompositePropertyLoader extends java.lang.Object implements PropertyLoader
A composite property loader contains a list a property loaders. It searches the requested properties in its children sequentially respecting the order they are added.
-
-
Constructor Summary
Constructors Constructor Description CompositePropertyLoader()Creates a new empty composite service loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyLoader(PropertyLoader propertyLoader)Adds a property loader at the end of the list a property loaders used by this composite property loader.java.lang.StringgetProperty(java.lang.String key)Gets the value mapped with the specified key.java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)Gets the value mapped with the specified key or a default value.
-
-
-
Method Detail
-
addPropertyLoader
public void addPropertyLoader(PropertyLoader propertyLoader)
Adds a property loader at the end of the list a property loaders used by this composite property loader.- Parameters:
propertyLoader- the property loader to add.- Throws:
java.lang.NullPointerException- if the given property loader isnull.
-
getProperty
@Nullable public java.lang.String getProperty(java.lang.String key)
Description copied from interface:PropertyLoaderGets the value mapped with the specified key.- Specified by:
getPropertyin interfacePropertyLoader- Parameters:
key- the key.- Returns:
- the value of the property, or
nullif the property is not found.
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)Description copied from interface:PropertyLoaderGets the value mapped with the specified key or a default value.- Specified by:
getPropertyin interfacePropertyLoader- Parameters:
key- the key.defaultValue- the default value.- Returns:
- the value of the property, or the default value if the property is not found.
-
-