Mappings - loicoudot/java4cpp-core GitHub Wiki

Mappings let's you define which C++ proxies must be generated from the Java classes, how to handle the classes hierarchy, which constructors, fields, methods must be mapped and so on.

There is two possibilities to define mappings :

  • Directly in the Java source code via annotation. Annotation are defined in the java4cpp-annotations artifact.

  • Via one or more xml files if you cannot change source code or if you don't want to add some annotations. An xml schema is available here and you sets the list of xml mappings file in java4cpp.mappingsFile system properties or in the configuration part of the java4cpp-maven-plugin.

Mapping contents of generated proxies

When a proxy is generated from a Java class, all the public constructors, public static fields, public methods and public inner classes are exported. You can select which of theses items you wan't in your resulting C++ proxies.

View mapping contents samples here.

Mapping hierarchy of generated proxies

When a proxy is generated for a Java class, no superclass nor interfaces are mapped. You can choose to generate the superclass proxy and select which of the interfaces will be produced.

View mapping hierarchy samples here.

Name mappings

By default, generated C++ names are the same as the java ones, with respect to a list of a reserved words. You can customize these names and the list of reserved words.

View name mappings samples here.

Package/Namespace mappings

By default, generated C++ proxies are in a namespace that correspond to the package of the java classes. You can customize this mappings.

View package/namespace mappings samples here.