Croway commented on code in PR #21581:
URL: https://github.com/apache/camel/pull/21581#discussion_r2841726128


##########
components/camel-git/src/main/java/org/apache/camel/component/git/GitEndpoint.java:
##########
@@ -91,15 +96,11 @@ public Producer createProducer() throws Exception {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        if (type == GitType.COMMIT) {
-            return new GitCommitConsumer(this, processor);
-        } else if (type == GitType.TAG) {
-            return new GitTagConsumer(this, processor);
-        } else if (type == GitType.BRANCH) {
-            return new GitBranchConsumer(this, processor);
-        } else {
-            throw new IllegalArgumentException("Cannot create consumer with 
type " + type);
-        }
+        return switch (type) {
+            case COMMIT -> new GitCommitConsumer(this, processor);
+            case TAG -> new GitTagConsumer(this, processor);
+            case BRANCH -> new GitBranchConsumer(this, processor);
+        };

Review Comment:
   I did a small refactor, and since GitType is an enum, the default is 
unnecessary, the default branch is dead code



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