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 class
PropertiesLoader.FileLocation
File location types.
-
Constructor Summary
Constructors Constructor Description PropertiesLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TypedProperties
load(String file)
Load properties from a file.static TypedProperties
load(String file, PropertiesLoader.FileLocation location)
Load properties from a file.static TypedProperties
load(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:
Properties
loaded from the file.null
is returned on failure.- Throws:
IllegalArgumentException
-file
isnull
.
-
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:
Properties
loaded from the file.null
is returned on failure.- Throws:
IllegalArgumentException
-file
isnull
, orlocations
isnull
.
-
load
public static TypedProperties load(String file, PropertiesLoader.FileLocation location)
Load properties from a file.- Parameters:
file
- File name. Iflocation
isCLASSPATH
and iffile
does not start with"/"
,"/"
is prepended.location
- Location from which the file is loaded.- Returns:
Properties
loaded from the file.null
is returned on failure.- Throws:
IllegalArgumentException
-file
isnull
, orlocation
isnull
.
-
-