cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter (JIRA)" <>
Subject [jira] [Created] (CB-4566) Code should use PluginResult.Status as an enum instead of int ordinal
Date Mon, 12 Aug 2013 00:22:48 GMT
Peter created CB-4566:

             Summary: Code should use PluginResult.Status as an enum instead of int ordinal
                 Key: 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, member status should be enum:
//private final int status;
private final Status status;
{code} method should return enum:
//public int getStatus() {
public Status getStatus() {
    return status;

Then the only places that actually need to use .ordinal() are those encoding methods in
For example:
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(' ')

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message