Uploaded image for project: 'Edgent'
  1. Edgent
  2. EDGENT-229

Streams and tuple type hierarchies - TStream.cast()?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • API
    • None

    Description

      In a real use case there were two different types of sensors that had
      a common interface/info to be analyzed. It took a bit to figure out how to
      deal with this. It certainly wasn't convenient.

      Imagine the tuple type hierarchy:

      class Base {};
      class Derived1 extends Base {};
      TStream<Derived1> sDerived1 = ...; // ingest

      class Derived2 extends Base {};
      TStream<Derived2> sDerived2 = ...; // ingest

      TStream<Base> sBase = sDerived1.union( sDerived2 );
      doAnalytics( sBase );

      The union() gets a compilation error because TStream<Derived*> doesn't extend TStream<Base>. Std java generics stuff. A straightforward cast doesn't work; it requires a bit more convoluted casting.

      [I'll capture the essence of a thread on the dev list for this below]

      Attachments

        Activity

          People

            Unassigned Unassigned
            dlaboss Dale LaBossiere
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: