Package

eu.cdevreeze.yaidom

bridge

Permalink

package bridge

This package contains abstract APIs and concrete implementations of so-called "bridge elements".

These bridge elements can play a role in supporting yaidom SubtypeAwareElemApi-backed XML dialects that can use multiple "DOM backends". These bridges abstract over those "backends".

Other projects can use as little or as much of these traits as desired. It would be quite natural to use only one purely abstract bridge element API of this package, provide an own implementation, and extend the API and implementation according to the needs of that project.

Currently these common bridge element APIs and implementations live in the XLink project, but maybe in the future they belong to the core yaidom project (so that no longer a dependency on this project is needed if XLink support itself is not needed).

Design notes

Why do we need all this wrapping? After all, a simple element is wrapped in a more general DefaultSimpleBridgeElem (possibly without any object creation costs), which is wrapped in another element such as a SimpleWrapperElem that offers the appropriate query API.

The "XML dialect API" offers the appropriate query API traits, and they are backed by pluggable DOM-like (yaidom) element implementations (which themselves may wrap elements from other libraries). The pluggable yaidom "backends" are essentially combinations of query API traits. The type parameter (assuming only one such parameter for now) of the element type itself must be introduced somewhere, however. Existential types (like ScopedElemApi[_]) are no option. One option is to have the enclosing context introduce the type parameter, but that would mean the use of the cake pattern, which comes with some inconveniences. Another option is to make the "XML dialect API" inheritance tree generic. That is inconvenient too. That leaves us with a bridge between generic "backends" and non-generic XML dialect support. Again, indirection saves the day.

As an aside, yaidom uses generics instead of abstract types to model F-bounded polymorphism, because generics turned out to be a better fit to implement the query API.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. bridge
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. final class DefaultIndexedBridgeElem extends AnyVal with IndexedBridgeElem

    Permalink

    Extensible bridge element taking an indexed.Elem.

    Extensible bridge element taking an indexed.Elem. This is a value class instance, to prevent object creation.

  2. final class DefaultSimpleBridgeElem extends AnyVal with SimpleBridgeElem

    Permalink

    Extensible simple bridge element taking a simple.Elem.

    Extensible simple bridge element taking a simple.Elem. This is a value class instance, to prevent object creation.

  3. trait IndexedBridgeElem extends SimpleBridgeElem

    Permalink

    Bridge element that extends SimpleBridgeElem with "indexing".

    Bridge element that extends SimpleBridgeElem with "indexing".

    It offers pluggable DOM-like element implementations, without any "type gymnastics" and without paying any "cake pattern tax".

    This is a purely abstract universal trait, allowing for allocation-free value objects.

  4. final class IndexedWrapperElem extends IndexedBridgeElem with ScopedElemLike[IndexedWrapperElem]

    Permalink

    This object is like a IndexedBridgeElem, but offering the ScopedElemLike and IsNavigable query API.

    This object is like a IndexedBridgeElem, but offering the ScopedElemLike and IsNavigable query API. It is itself also a IndexedBridgeElem, and wraps a IndexedBridgeElem.

    Use this object when you want a IndexedBridgeElem, but at the same time want to use the yaidom query API.

  5. trait SimpleBridgeElem extends Any

    Permalink

    Bridge element that enables the ScopedElemLike API (and more) on the classes delegating to this bridge element.

    Bridge element that enables the ScopedElemLike API (and more) on the classes delegating to this bridge element.

    It offers pluggable DOM-like element implementations, without any "type gymnastics" and without paying any "cake pattern tax".

    This is a purely abstract universal trait, allowing for allocation-free value objects.

  6. final class SimpleWrapperElem extends SimpleBridgeElem with ScopedElemLike[SimpleWrapperElem]

    Permalink

    This object is like a SimpleBridgeElem, but offering the ScopedElemLike and IsNavigable query API.

    This object is like a SimpleBridgeElem, but offering the ScopedElemLike and IsNavigable query API. It is itself also a SimpleBridgeElem, and wraps a SimpleBridgeElem.

    Use this object when you want a SimpleBridgeElem, but at the same time want to use the yaidom query API.

Inherited from AnyRef

Inherited from Any

Ungrouped