コード例 #1
0
 @Override
 public void doComplete(CompletionInfo completions, String partial, int flags) {
   partial = partial.toLowerCase();
   for (IBMPartitionTypes pt : IBMPartitionTypes.values()) {
     String code = Integer.toHexString(pt.getCode());
     if (code.startsWith(partial)) {
       completions.addCompletion(code);
     }
   }
 }
コード例 #2
0
 @Override
 protected IBMPartitionTypes doAccept(Token value, int flags) throws CommandSyntaxException {
   try {
     int code = Integer.parseInt(value.text, 16);
     return IBMPartitionTypes.valueOf(code);
   } catch (NumberFormatException ex) {
     throw new CommandSyntaxException("not a valid hexadecimal number");
   } catch (IllegalArgumentException ex) {
     throw new CommandSyntaxException(ex.getMessage());
   }
 }