jam01 commented on a change in pull request #4561:
URL: https://github.com/apache/camel/pull/4561#discussion_r535500428



##########
File path: 
core/camel-core-model/src/main/java/org/apache/camel/builder/DatasonnetBuilder.java
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.builder;
+
+import org.apache.camel.Expression;
+import org.apache.camel.model.language.DatasonnetExpression;
+
+public class DatasonnetBuilder extends ValueBuilder {

Review comment:
       Ah! Copy that. Would it be OK if we alternatively move the extra methods 
to the camel-datasonnet DatasonnetExpression? I see XPath has support for 
building expressions from both camel-core-model 
[BuilderSupport](https://github.com/apache/camel/blob/master/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java#L197)
 and also from camel-xpath's 
[XPathBuilder](https://github.com/apache/camel/blob/master/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java#L156).
 The camel-xpath one actually has optional parameter support, just as we were 
looking for, as showcased in [this 
test](https://github.com/apache/camel/blob/master/core/camel-core/src/test/java/org/apache/camel/component/dataset/CustomDataSetTest.java#L34).
 Here's [an 
example](https://github.com/apache/camel/blob/master/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathHeaderEnableSaxonJavaDslTest.java#L67)
 of the camel-xpath one being used 
 in a route instead of the RouteBuilder one.
   
   So developers could use the BuilderSupport one if they just want default 
media types, or the camel-datasonnet one if they want to be explicit in either 
one or both. Additionally this would allow us to user DataSonnet's formal 
MediaType objects instead of their String representation. I used the String 
representation in the BuilderSupport as to not have core-model depend on the 
DataSonnet Mapper. This would translate into some performance gains as the 
String will not need to be parsed on each expression evaluation.




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

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


Reply via email to