superbAura commented on code in PR #2410:
URL: https://github.com/apache/james-project/pull/2410#discussion_r1766020840


##########
protocols/imap/src/main/java/org/apache/james/imap/main/DefaultImapDecoderFactory.java:
##########
@@ -27,20 +27,35 @@
 import org.apache.james.imap.message.response.UnpooledStatusResponseFactory;
 
 /**
- * TODO: this is temporary: should let the container do the coupling. TODO:
- * convert to POJO
+ * Factory class for creating `ImapDecoder` instances.
+ *
+ * This class is a POJO that manually manages its dependencies.
+ * Dependencies are injected through the constructor, which allows for
+ * better decoupling and easier testing.
+ *
+ * The creation of `ImapCommandParserFactory` is handled internally by
+ * this factory, based on the provided `UnpooledStatusResponseFactory`.
  */
 public class DefaultImapDecoderFactory implements ImapDecoderFactory {
 
-    public static ImapDecoder createDecoder() {
-        final UnpooledStatusResponseFactory unpooledStatusResponseFactory = 
new UnpooledStatusResponseFactory();
-        final ImapCommandParserFactory imapCommands = new 
ImapParserFactory(unpooledStatusResponseFactory);
-        return new DefaultImapDecoder(unpooledStatusResponseFactory, 
imapCommands);
+    private final UnpooledStatusResponseFactory unpooledStatusResponseFactory;
+    private final ImapCommandParserFactory imapCommandParserFactory;
+
+    /**
+     * Constructs `DefaultImapDecoderFactory` with the given
+     * `UnpooledStatusResponseFactory`. The `ImapCommandParserFactory`
+     * is created internally using the provided 
`UnpooledStatusResponseFactory`.
+     *
+     * @param unpooledStatusResponseFactory The factory for creating status 
responses.
+     */
+    public DefaultImapDecoderFactory(UnpooledStatusResponseFactory 
unpooledStatusResponseFactory) {

Review Comment:
   Understood. I will check if it's possible to refactor based on what you 
mentioned.
   Thank you for the review.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to