Generating code for Java within a specific package

3 posts / 0 new
Last post
Offline
Last seen: 5 years 3 months ago
Joined: 01/09/2013
Posts: 10
Generating code for Java within a specific package

Hi,

I develop a Java application with DDS and I want to structure the code into several Java packages. For instance, I put the DDS-related code into a package called "com.mycompany.project.dds", and I intend to put the generated code into "com.mycompany.project.dds.datamodel".

To not have Java errors, the code that is generated by rtiddsgen shall be really in this package, not just copied in the corresponding directory. So, I have to start my IDL file with something like:

module com {
  module mycompany {
    module project {
      module dds {
        module datamodel {
          ...
};};};};};

Is there a means to avoid this poor solution and to provide an option to rtiddsgen to generate the code into a particular package?

Best regards.


Jean-François

 

gianpiero's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

 

Hello Jean-François,

Yes, rtiddsgen has an option called "-package" that allows you to specify the package name.

If you have a file Foo.idl

struct Foo {
    long id;
}; 

And you call rtiddsgen like this:

rtiddsgen -language Java -package com.mycompany.project.dds.datamodel Foo.idl 

The generated code will end-up in com/mycompany/project/dds/datamodel/

You can check all the option that rtiddsgen has by running it with the -help option.

Let me know if this solves your issue.

Regads, 

  Gianpiero

Offline
Last seen: 5 years 3 months ago
Joined: 01/09/2013
Posts: 10

Thanks a lot. It works perfectly.