How to design a class for managing file path ?
- by remi bourgarel
Hi All
In my app, I generate some xml file for instance : "/xml/product/123.xml" where 123 is the product's id and 123.xml contains informations about this product. I also have "/xml/customer/123.xml" where 123.xml contains informations about the client ... 123
How can I manage these file paths :
1/ - I create the file path directly in the seralization method ?
2/ I create 2 static class : CustomerSerializationPathManager and ProductSerializationPathManager with 1 method : getPath(int customerID) and getPath(int productID)
3/ I create one static class : SerializationPathManager with 2 method : getCustomerPath(int customerID) and getProductPath(int productID)
4/ something else
I'd prefer the solution 3 cause if I think there's only one reason to change this class : I change the root directory.
So I'd like to have your thoughts about it... thx