public class PropertiesLoader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PropertiesLoader.FileLocation
File location types.
|
Constructor and Description |
---|
PropertiesLoader() |
Modifier and Type | Method and 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.
|
public static TypedProperties load(String file)
This method is an alias of load
(file,
FileLocation
.values())
.
file
- File name.Properties
loaded from the file.
null
is returned on failure.IllegalArgumentException
- file
is null
.public static TypedProperties load(String file, PropertiesLoader.FileLocation[] locations)
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.
file
- File name.locations
- Locations from which the file is loaded.Properties
loaded from the file.
null
is returned on failure.IllegalArgumentException
- file
is null
, or locations
is null
.public static TypedProperties load(String file, PropertiesLoader.FileLocation location)
file
- File name. If location
is CLASSPATH
and if file
does not start with "/"
,
"/"
is prepended.location
- Location from which the file is loaded.Properties
loaded from the file.
null
is returned on failure.IllegalArgumentException
- file
is null
, or location
is null
.Copyright © 2016. All rights reserved.