You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/09/29 09:25:04 UTC

[jira] [Resolved] (CAMEL-8420) Not possible to use inner classes for Dtos in Camel Swagger

     [ https://issues.apache.org/jira/browse/CAMEL-8420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-8420.
--------------------------------
       Resolution: Fixed
         Assignee: Claus Ibsen
    Fix Version/s: 2.16.0

> Not possible to use inner classes for Dtos in Camel Swagger
> -----------------------------------------------------------
>
>                 Key: CAMEL-8420
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8420
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-swagger
>    Affects Versions: 2.14.1
>            Reporter: Espen Tjonneland
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.16.0
>
>
> If you inline your Dto classes with your services then Camel fails to load them (ClassNotFoundException).
> Can easily be reproduced by modifying the Camel :: Example :: Serlet REST  example by moving the User class into the UserService and update the UserRoute builder to use the moved type.
> {code:title=UserService.java|borderStyle=solid}
> public class UserService {
>     // use a tree map so they become sorted
>     private final Map<String, org.apache.camel.example.rest.UserService.User> users = new TreeMap<String, org.apache.camel.example.rest.UserService.User>();
>     private Random ran = new Random();
>     public UserService() {
>         users.put("123", new org.apache.camel.example.rest.UserService.User(123, "John Doe"));
>         users.put("456", new org.apache.camel.example.rest.UserService.User(456, "Donald Duck"));
>         users.put("789", new org.apache.camel.example.rest.UserService.User(789, "Slow Turtle"));
>     }
>     /**
>      * Gets a user by the given id
>      *
>      * @param id  the id of the user
>      * @return the user, or <tt>null</tt> if no user exists
>      */
>     public org.apache.camel.example.rest.UserService.User getUser(String id) {
>        ....
>     }
>     /**
>      * List all users
>      *
>      * @return the list of all users
>      */
>     public Collection<org.apache.camel.example.rest.UserService.User> listUsers() {
>        ....
>     }
>     /**
>      * Updates or creates the given user
>      *
>      * @param user the user
>      */
>     public void updateUser(org.apache.camel.example.rest.UserService.User user) {
>         ....
>     }
>     public static class User {
>         private int id;
>         private String name;
>         ........
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)