Revision history [back]

click to hide/show revision 1
initial version

Dynamic definition of Interface in java

The C++ API is pretty dynamic : one can create at runtime an Interface and add methods, signals and properties to it. It is also possible in C++ to call a method on an Interface that you don't know at runtime.

The java binding on the other hand, is really static : you need to define the Interfaces you are going to use during development, with appropriate annotations, to be able to call methods on it. Also you cannot create a new interface at run-time. While the annotation approach is very conveninent in many cases, there are some use cases where I really want to create an advertise new interfaces at run-time.

Is there any rationnal behind this design ? is that a deliberate choic or just something that is not implemented yet ?

Dynamic definition of Interface in java

The C++ API is pretty dynamic : one can create at runtime an Interface and add methods, signals and properties to it. It is also possible in C++ to call a method on an Interface that you don't know at runtime.

The java binding on the other hand, is really static : you need to define the Interfaces you are going to use during development, with appropriate annotations, to be able to call methods on it. Also you cannot create a new interface at run-time. While As pointed , the annotation approach a some major advantages and is very conveninent in many cases, there are most cases.

However, I feel this approach is not always suitable : * in some use cases where I environment, reflexion is not authorized (HGI - OSGI, for example) * sometimes, you really want to create an advertise new interfaces at run-time.need dynamicity

Is there any rationnal behind this design ? is that a deliberate choic or just something that is not implemented yet ?? I was looking at the code in InterfaceDescription.java as a starting point to implement such dynamicity, could you point me to some jni-binding issues I may encounter and that would make this more difficult than I thought it would be ?

Dynamic definition of Interface in java

The C++ API is pretty dynamic : one can create at runtime an Interface and add methods, signals and properties to it. It is also possible in C++ to call a method on an Interface that you don't know at runtime.

The java binding on the other hand, is really static : you need to define the Interfaces you are going to use during development, with appropriate annotations, to be able to call methods on it. Also you cannot create a new interface at run-time. As pointed , the annotation approach a some major advantages and is very conveninent in most cases.

However, I feel this approach is not always suitable : *

  • in some environment, reflexion is not authorized (HGI - OSGI, for example) * example)
  • sometimes, you really need dynamicity

Is there any rationnal behind this design ? is that a deliberate choic or just something that is not implemented yet ? I was looking at the code in InterfaceDescription.java as a starting point to implement such dynamicity, could you point me to some jni-binding issues I may encounter and that would make this more difficult than I thought it would be ?