An instance of java.util.Properties is passed to me which has been created using:
[...]
properties = new java.util.Properties();
try {
properties.load(
AutoProperties.class.getClassLoader().getResourceAsStream(propertyFile)
);
}
[...]
I was wondering how I could retrieve the file name (propertyFile above) from the properties instance? I had a glance at the API and couldn’t see any easy way to do it.
The file name (or path name in this case) is not stored in the
Propertiesinstance. In fact, you haven’t even passed the name to the instance.