eu.cdevreeze.yaidom

subtypeaware

package subtypeaware

Query traits that resemble ParentElemApi and ParentElemLike, but offering query support for object hierarchies.

For example, XML Schema can be modeled with an object hierarchy, starting with some XsdElem super-type which mixes in trait SubtypeAwareParentElemApi, among other query traits. The object hierarchy could contain sub-classes of XsdElem such as XsdRootElem, GlobalElementDeclaration, etc. Then the SubtypeAwareParentElemApi trait makes it easy to query for all or some global element declarations, etc.

There is no magic in these traits: it is just ParentElemApi and ParentElemLike underneath. It is only the syntactic convenience that makes the difference.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. subtypeaware
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait SubtypeAwareParentElemApi[A <: SubtypeAwareParentElemApi[A]] extends ParentElemApi[A]

    Extension to ParentElemApi that makes querying for sub-types of the element type easy.

    Extension to ParentElemApi that makes querying for sub-types of the element type easy.

    The query methods of this trait take a sub-type as first value parameter. It is intentional that this is a value parameter, and not a second type parameter, since it is conceptually the most important parameter of these query methods. (If it were a second type parameter instead, the article http://hacking-scala.org/post/73854628325/advanced-type-constraints-with-type-classes would show how to make that solution robust, using some @NotNothing annotation.)

    The sub-type parameter could have been a java.lang.Class object, except that type erasure would make it less attractive (when doing pattern matching against that type). Hence the use of a ClassTag parameter, which undoes type erasure for non-generic types, if available implicitly. So ClassTag is used as a better java.lang.Class, yet without polluting the public API with an implicit ClassTag parameter. (Instead, the ClassTag is made implicit inside the method implementations.)

  2. trait SubtypeAwareParentElemLike[A <: SubtypeAwareParentElemLike[A]] extends ParentElemLike[A] with SubtypeAwareParentElemApi[A]

    Default implementation of SubtypeAwareParentElemApi.

Value Members

  1. object SubtypeAwareParentElemApi

Inherited from AnyRef

Inherited from Any

Ungrouped