You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by "Dale LaBossiere (JIRA)" <ji...@apache.org> on 2016/07/13 15:49:20 UTC

[jira] [Created] (QUARKS-229) Streams and tuple type hierarchies - TStream.cast()?

Dale LaBossiere created QUARKS-229:
--------------------------------------

             Summary: Streams and tuple type hierarchies - TStream.cast()?
                 Key: QUARKS-229
                 URL: https://issues.apache.org/jira/browse/QUARKS-229
             Project: Quarks
          Issue Type: Improvement
            Reporter: Dale LaBossiere
            Priority: Minor


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]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)