You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Matheus Eduardo Machado Moreira (JIRA)" <ji...@apache.org> on 2014/06/06 22:57:02 UTC

[jira] [Commented] (TAP5-2349) JSONObject (& JSONArray) should not be final, to allow json-based type safety that interacts well with Tapestry

    [ https://issues.apache.org/jira/browse/TAP5-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14020357#comment-14020357 ] 

Matheus Eduardo Machado Moreira commented on TAP5-2349:
-------------------------------------------------------

What is the benefit of a "typed" JSONObject as suggested? You could use a JSON-POJO mapper to facilitate creation and parsing of JSON objects or you could create builder/helper classes to help you build and validate the JSON object that you want (and your pages, services, etc know).

I see no purpose in this issue.

> JSONObject (& JSONArray) should not be final, to allow json-based type safety that interacts well with Tapestry
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-2349
>                 URL: https://issues.apache.org/jira/browse/TAP5-2349
>             Project: Tapestry 5
>          Issue Type: New Feature
>          Components: tapestry-json
>    Affects Versions: 5.4
>            Reporter: Robert Hailey
>            Priority: Minor
>              Labels: json
>
> For example, one might want to make a special type to communicate with the client-side page:
> {noformat}
> class AlertMessage extends JSONObject
> {
>     AlertMessage() { put("type", "alert"); }
>     public void withMessage(String message)
>     {
>         put("message", message);
>     }
> }
> {noformat}
> ...such would minimize the proliferation of the field name strings, allow passing custom json-backed types to various pages & services, etc.



--
This message was sent by Atlassian JIRA
(v6.2#6252)