Package com.authlete.common.util
Class PropertiesLoader
- java.lang.Object
-
- com.authlete.common.util.PropertiesLoader
-
public class PropertiesLoader extends Object
Properties loader.- Author:
- Takahiko Kawasaki
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPropertiesLoader.FileLocationFile location types.
-
Constructor Summary
Constructors Constructor Description PropertiesLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TypedPropertiesload(String file)Load properties from a file.static TypedPropertiesload(String file, PropertiesLoader.FileLocation location)Load properties from a file.static TypedPropertiesload(String file, PropertiesLoader.FileLocation[] locations)Load properties from a file.
-
-
-
Method Detail
-
load
public static TypedProperties load(String file)
Load properties from a file.This method is an alias of
load(file,FileLocation.values()).- Parameters:
file- File name.- Returns:
Propertiesloaded from the file.nullis returned on failure.- Throws:
IllegalArgumentException-fileisnull.
-
load
public static TypedProperties load(String file, PropertiesLoader.FileLocation[] locations)
Load properties from a file.This method tries to load the file from the given locations in the order by calling
load(String, FileLocation). The content of the first successfully-loaded file is returned.- Parameters:
file- File name.locations- Locations from which the file is loaded.- Returns:
Propertiesloaded from the file.nullis returned on failure.- Throws:
IllegalArgumentException-fileisnull, orlocationsisnull.
-
load
public static TypedProperties load(String file, PropertiesLoader.FileLocation location)
Load properties from a file.- Parameters:
file- File name. IflocationisCLASSPATHand iffiledoes not start with"/","/"is prepended.location- Location from which the file is loaded.- Returns:
Propertiesloaded from the file.nullis returned on failure.- Throws:
IllegalArgumentException-fileisnull, orlocationisnull.
-
-