ppkarwasz commented on PR #3968:
URL: https://github.com/apache/logging-log4j2/pull/3968#issuecomment-3520744498

   > Ideally `getFileManager()` should pass a DTO instead of 3 dozen arguments, 
but that is a thicker refactoring.
   
   This is exacly what I tried to eliminate here: a `private` DTO 
(`FactoryData`) that is used in a single method is more confusing than useful. 
Configuration data ends up being packed and unpacked multiple times:
   
   1. It is packed into a `FileAppender.Builder`,
   2. It is unpacked and passed to `FileManager.getFileManager()`,
   3. It is packed into a `FileManager.FactoryData`,
   4. It is unpacked again by `FileManagerFactory`,
   5. It is finally used be the `FileManager` constructor.
   
   All along this path, the data is validated multiple times, defaults are 
applied and also some side-effects (creation of parent directory) appear.
   
   If `FileManager` was a class carefully designed to be reusable, then I 
agree: a DTO (possibly a Java record) as only parameter to `getFileManager()` 
would be useful.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to