public class PropertiesRepository extends Object implements Repository
Repository class providing access to a configuration repository backed by Properties files| Constructor and Description |
|---|
PropertiesRepository(File propertiesFile)
Creates a new
PropertiesRepository from the provided propertiesFile |
PropertiesRepository(String filename)
Creates a new
PropertiesRepository from the provided properties file filename |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying properties file.
|
File |
getPropertiesFile() |
void |
open()
Opens the properties file and reads its
Properties |
String |
read(String name)
Returns the value for a property name or null
|
void |
setPropertiesFile(File propertiesFile) |
public PropertiesRepository(String filename)
PropertiesRepository from the provided properties file filenamefilename - The filename of the properties fileIllegalArgumentException - If the provided filename is null or emptypublic PropertiesRepository(File propertiesFile)
PropertiesRepository from the provided propertiesFilepropertiesFile - The properties FileIllegalArgumentException - If the provided File is nullpublic void open()
throws RepositoryException
Propertiesopen in interface RepositoryRepositoryException - If the propertiesFile is null, doesn't exist or an error occurred while
reading the properties file.public String read(String name)
read in interface Repositoryname - The parameter namepublic void close()
throws RepositoryException
close in interface RepositoryRepositoryExceptionpublic File getPropertiesFile()
public void setPropertiesFile(File propertiesFile)
Copyright © 2022. All rights reserved.