Generate OpaqueObject implementation 53/81653/19
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 15 Apr 2019 08:02:03 +0000 (10:02 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Apr 2019 16:36:25 +0000 (18:36 +0200)
commit9ceab95fc804f9042da6088d843c8cd3a57aed29
tree707f61904e480b5988e7316f448bf7b22199c6eb
parentcd0e4ce77caa250e64dd7edabfbfc2952c5d6a85
Generate OpaqueObject implementation

With the advent of CodecClassLoader we can safely instantiate
codec-specific implementations of binding interfaces instead
of relying on dynamic proxies.

This has several advantages:
- we do not generate a proxy class in public space, hence our mess
  will undergo normal GC rules
- generated code is a normal final class, hence we can inherit
  method implementations from interfaces and subclasses
- for each instance, we do not require a proxy and an invocation
  handler, so we instantiate only one object
- there is no reflection in the invocation path, hence JIT has
  full (and direct) visibility and can perform all of its magic

This patch does that for OpaqueObject, which results extremely
simple generated classes: they just subclass a ForeignOpaqueObject
and add the target binding interface.

JIRA: MDSAL-442
Change-Id: I2be5bb88f9557375f517415d6bec9f68e803628c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/BindingCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/CodecOpaqueObject.java [new file with mode: 0644]
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ForeignOpaqueObject.java [deleted file]
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/OpaqueNodeCodecContext.java