edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale LaBossiere (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (EDGENT-407) JsonFunctions: more convenience functions for creation and unpartitioned window
Date Tue, 02 Jan 2018 18:59:00 GMT

     [ https://issues.apache.org/jira/browse/EDGENT-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dale LaBossiere closed EDGENT-407.
----------------------------------

> JsonFunctions: more convenience functions for creation and unpartitioned window
> -------------------------------------------------------------------------------
>
>                 Key: EDGENT-407
>                 URL: https://issues.apache.org/jira/browse/EDGENT-407
>             Project: Edgent
>          Issue Type: Wish
>          Components: API
>            Reporter: Dale LaBossiere
>            Assignee: Dale LaBossiere
>             Fix For: Apache Edgent 1.2.0
>
>
> Recently I've found myself repetitively doing the following when transforming a stream
of simple numerics into a JsonObject (e.g., for publishing via IotDevice(TStream<JsonObject>)):
> {code}
> TStream<Double> s = ...
> TStream<JsonObject> js = s.map(val -> {
>   JsonObject jo = new JsonObject();
>   jo.addProperty("propName", val);
>   return jo.
> });
> {code}
> Unfortunately, addProperty() returns void so the above can't be reduced to something
like: 
> {code}
> return new JsonObject().addProperty("propName", val)
> {code}
> I'd like an ease-of-use function like:
> {code}
> TStream<JsonObject> js = s.map(JsonFunctions.valueOfNumber("propName"));
> {code}
> For completeness, there should also be {{valueOfString(), valueOfCharacter(), valueOfBoolean()}}.
> Also, JsonAnalytics works with JsonElement partitioned windows: {{TWindow<JsonObject,JsonElement>}}.
 It should be trivial to be able to specify an unpartitioned window.  {{Functions.unpartitioned()}}
provides that for Integer keyed windows.  There should be a corresponding {{JsonFunctions.unpartitioned()}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message