Refactoring IntentRemoveCommand to be more clear about use of 'key'
Change-Id: I3e84f510ffb5eda30cfe8166e858398c0af28d83
Showing
1 changed file
with
9 additions
and
8 deletions
| ... | @@ -48,10 +48,10 @@ public class IntentRemoveCommand extends AbstractShellCommand { | ... | @@ -48,10 +48,10 @@ public class IntentRemoveCommand extends AbstractShellCommand { |
| 48 | required = true, multiValued = false) | 48 | required = true, multiValued = false) |
| 49 | String applicationIdString = null; | 49 | String applicationIdString = null; |
| 50 | 50 | ||
| 51 | - @Argument(index = 1, name = "id", | 51 | + @Argument(index = 1, name = "key", |
| 52 | - description = "Intent ID", | 52 | + description = "Intent Key", |
| 53 | required = true, multiValued = false) | 53 | required = true, multiValued = false) |
| 54 | - String id = null; | 54 | + String keyString = null; |
| 55 | 55 | ||
| 56 | @Option(name = "-p", aliases = "--purge", | 56 | @Option(name = "-p", aliases = "--purge", |
| 57 | description = "Purge the intent from the store after removal", | 57 | description = "Purge the intent from the store after removal", |
| ... | @@ -78,12 +78,13 @@ public class IntentRemoveCommand extends AbstractShellCommand { | ... | @@ -78,12 +78,13 @@ public class IntentRemoveCommand extends AbstractShellCommand { |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | final Key key; | 80 | final Key key; |
| 81 | - if (id.startsWith("0x")) { | 81 | + if (keyString.startsWith("0x")) { |
| 82 | - id = id.replaceFirst("0x", ""); | 82 | + // The intent uses a LongKey |
| 83 | - key = Key.of(new BigInteger(id, 16).longValue(), appId); | 83 | + keyString = keyString.replaceFirst("0x", ""); |
| 84 | + key = Key.of(new BigInteger(keyString, 16).longValue(), appId); | ||
| 84 | } else { | 85 | } else { |
| 85 | - // This line is to use the intent key to delete an intent | 86 | + // The intent uses a StringKey |
| 86 | - key = Key.of(id, appId); | 87 | + key = Key.of(keyString, appId); |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | Intent intent = intentService.getIntent(key); | 90 | Intent intent = intentService.getIntent(key); | ... | ... |
-
Please register or login to post a comment