@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); } } }
@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()); } }