You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "orpiske (via GitHub)" <gi...@apache.org> on 2023/06/08 15:31:58 UTC

[GitHub] [camel] orpiske commented on a diff in pull request #10291: CAMEL-19307: camel-yaml-io - YAML route dumper

orpiske commented on code in PR #10291:
URL: https://github.com/apache/camel/pull/10291#discussion_r1223207232


##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java:
##########
@@ -550,6 +551,21 @@ protected ModelToXMLDumper createModelToXMLDumper() {
         }
     }
 
+    @Override
+    protected ModelToYAMLDumper createModelToYAMLDumper() {
+        Optional<ModelToYAMLDumper> result = ResolverHelper.resolveService(
+                getCamelContextReference(),
+                getBootstrapFactoryFinder(),
+                ModelToYAMLDumper.FACTORY,
+                ModelToYAMLDumper.class);
+
+        if (result.isPresent()) {
+            return result.get();
+        } else {
+            throw new IllegalArgumentException("Cannot find ModelToYAMLDumper on classpath. Add camel-yaml-io to classpath.");
+        }

Review Comment:
   Maybe something like?
   ```
   result.orElseThrow(() -> new IllegalArgumentException("Cannot find ModelToYAMLDumper on classpath. Add camel-yaml-io to classpath."));
   ```



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org