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

Joe Bowser resolved CB-4566.
----------------------------
    Resolution: Won't Fix

This is an API change that affects plugin developers, and as such has to be 
done on a major version.  This has gone stale due to it sitting as a minor 
improvement for so long.  If you want this API to change, it's better to 
propose it now before 4.0.x gets out the door.

> Code should use PluginResult.Status as an enum instead of int ordinal
> ---------------------------------------------------------------------
>
>                 Key: CB-4566
>                 URL: https://issues.apache.org/jira/browse/CB-4566
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>    Affects Versions: 2.9.0
>            Reporter: Peter
>            Assignee: Joe Bowser
>            Priority: Minor
>
> Since PluginResult.Status is an enum, it would be better to use it as enum 
> wherever it is used instead of referring to .ordinal() everywhere.
> * code will be easier to read
> * code will be shorter
> * debugging of status value will be easier
> For example, PluginResult.java member status should be enum:
> {code}
> //private final int status;
> private final Status status;
> {code}
> PluginResult.java method should return enum:
> {code}
> //public int getStatus() {
> public Status getStatus() {
>     return status;
> }
> {code}
> Then the only places that actually need to use .ordinal() are those encoding 
> methods in NativeToJsMessageQueue.java. For example:
> {code}
> PluginResult.Status status = pluginResult.getStatus();
> boolean noResult = status == PluginResult.Status.NO_RESULT;
> boolean resultOk = status == PluginResult.Status.OK;
> boolean keepCallback = pluginResult.getKeepCallback();
> sb.append((noResult || resultOk) ? 'S' : 'F')
>     .append(keepCallback ? '1' : '0')
>     .append(status.ordinal())
>     .append(' ')
> ...
> {code}
> and the (deprecated) PluginResult.getJSONString()



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to