Interface FileLocatorAware
- All Known Implementing Classes:
PropertiesConfiguration
,XMLConfiguration
,XMLPropertiesConfiguration
,XMLPropertyListConfiguration
Definition of an interface to be implemented by FileBased
objects which need access to the current
FileLocator
.
When loading or saving a FileBased
object using FileHandler
the handler eventually invokes the
read()
or write()
methods passing in a reader or writer. For some implementations this may not be
sufficient because they need information about the current location. For instance, a concrete FileBased
implementation may have to resolve other data sources based on relative file names which have to be interpreted in
the context of the current file location.
To deal with such scenarios, affected implementations can choose to implement this interface. They are then passed
the current location to the file being accessed before their read()
or write()
method is called.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
initFileLocator
(FileLocator locator) Passes the currentFileLocator
to this object.
-
Method Details
-
initFileLocator
Passes the currentFileLocator
to this object. Note that thisFileLocator
object is only temporarily valid for the following invocation ofread()
orwrite(
. Depending on the state of theFileHandler
and which of its methods was called, the object may not be fully initialized. For instance, if theFileHandler
'sload(InputStream)
method was called, no file information is available, and all methods of theFileLocator
will return null.- Parameters:
locator
- the currentFileLocator
-