Interface FileLocatorAware
-
- All Known Implementing Classes:
PropertiesConfiguration,XMLConfiguration,XMLPropertiesConfiguration,XMLPropertyListConfiguration
public interface FileLocatorAware
Definition of an interface to be implemented by
FileBasedobjects which need access to the currentFileLocator.When loading or saving a
FileBasedobject usingFileHandlerthe handler eventually invokes theread()orwrite()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 concreteFileBasedimplementation 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()orwrite()method is called.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidinitFileLocator(FileLocator locator)Passes the currentFileLocatorto this object.
-
-
-
Method Detail
-
initFileLocator
void initFileLocator(FileLocator locator)
Passes the currentFileLocatorto this object. Note that thisFileLocatorobject is only temporarily valid for the following invocation ofread()orwrite(. Depending on the state of theFileHandlerand 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 theFileLocatorwill return null.- Parameters:
locator- the currentFileLocator
-
-