Skip to main content

Module interface_java

Module interface_java 

Source
Expand description

An IDL interface, as the Java language binding DDS-RPC 1.0 §7.11.2 specifies.

§7.11.2 is short on purpose: “The following sub clauses describe the entities that are either different or not described in the C++ language bindings”, and §7.11.2.3 then says the function-call style “shall define the same entities as that of C++”. So this column is the C++ one of emit::interface_cpp read through two substitutions — org.omg.dds.rpc.Future<T> for dds::rpc::future<T> (§7.11.2.2.4) and the DDS-Java-PSM type mapping for the DDS-Cxx-PSM one — and one difference the substitution cannot absorb.

§The difference: out and inout

C++ passes them by reference; §7.11.1.1.2 rule 6.e sends that to DDS-Cxx-PSM §7.4.5, whose answer is T&. Java has no T&. The [IDL2Java] mapping’s answer is a Holder class per type, and §7.11.2 does not take it — it sends the type mapping to [DDS-Java-PSM], which has no holders.

What it does name is ${interface}_${operation}_Out: rule 7.i makes that the payload of the future an asynchronous operation with out or inout parameters returns. The same type is what the synchronous operation returns here. So the multiple return travels in a type the specification itself names for exactly this call shape, rather than in n holder classes it does not name at all.

§Exceptions

No throws clause, on any generated method. Rule 6.c: “The functions shall not have any exception specification even if the IDL operation has an exception specification. The implementation may still throw the exceptions specified by the IDL operation.” §7.11.2 overrides nothing about it, and §7.11.2.1 — Java’s own “Mapping of Exceptions” — has no body in the published document, which under §7.11.2’s preamble means the C++ clause stands. The C++ hierarchy of Figure 7.6 puts every remote exception under std::runtime_error or std::logic_error, both unchecked; the Java counterpart of an unchecked exception needs no throws.

The raises clause is still visible: it is written into the method’s documentation, so a reader of the generated file sees what the IDL declared rather than nothing at all. The same line goes into the C++ output for the same reason.

§Where it lands

One outer class, as adapter::java’s crate::adapter::java::OUTER is one outer class and for the same reason: Java allows one public top-level type per file. The data types are written from ZdTypes down and the services from OUTER down, which is what java_member_type already spells for every type a signature names.

Constants§

OUTER
The class every generated service nests inside.

Functions§

java_interface_items
The Java declarations every interface of ast produces.
java_interface_items_with
java_interface_items for the given service mapping.