[ 
https://issues.apache.org/jira/browse/CAMEL-15199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17138197#comment-17138197
 ] 

Claus Ibsen commented on CAMEL-15199:
-------------------------------------

Yes its for XML DSL. Where the information is stored as the string.

And in Java DSL then by using Class we can make it type safe and shorter/nicer, 
instead of having to type the FQN classname.
We could in the definition allow to store the type as Class as well as 
@XmlTransient (we do this in some other places). Then we dont need to load it 
if using Java DSL.

> RestDefinition relies on Class.getCanonicalName instead of Class.getName for 
> in/out types
> -----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-15199
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15199
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core-engine
>            Reporter: Luca Burgazzoli
>            Assignee: Luca Burgazzoli
>            Priority: Major
>             Fix For: 3.4.1, 3.5.0
>
>
> RestDefinition 
> [relies|https://github.com/apache/camel/blob/3380f7f616b08976627c13a5c232bfc105ace3ae/core/camel-core-engine/src/main/java/org/apache/camel/model/rest/RestDefinition.java#L456-L476]
>  on Class.getCanonicalName instead of Class.getName for in/out types.
> This work as long as the type is not an inner class getCanonicalName does not 
> return a name that can be used to load a class.
> As example
> {code:java}
> package my.example;
> public class MyRoutes extends org.apache.camel.builder.RouteBuilder {
>     @Override
>     public void configure() throws Exception {
>         rest()
>             .post("/order")
>                 .type(MyOrder.class)
>                 .consumes("application/json")
>                 .produces("application/json")
>                 .bindingMode(RestBindingMode.json)
>                 .route()
>                     .log("${body}");
>     }
>     public static class MyOrder {
>         public String id;
>     }
> }
> {code}
> Then camel would set my.example.MyRoutes.MyOrder as in type but that's wrong 
> and the subsequent attemp to load the class by name, will fail as it should 
> be my.example.MyRoutes$MyOrder (which is what Class.getName would return).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to