Java Code Examples for org.apache.commons.lang3.text.StrTokenizer#getTokenList()
The following examples show how to use
org.apache.commons.lang3.text.StrTokenizer#getTokenList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PathUtils.java From dremio-oss with Apache License 2.0 | 5 votes |
/** * Convert fs path to list of strings. * /a/b/c -> [a,b,c] * @param fsPath a string * @return list of path components */ public static List<String> toPathComponents(String fsPath) { if (fsPath == null ) { return EMPTY_SCHEMA_PATHS; } final StrTokenizer tokenizer = new StrTokenizer(fsPath, SLASH_CHAR, SqlUtils.QUOTE).setIgnoreEmptyTokens(true); return tokenizer.getTokenList(); }
Example 2
Source File: PathUtils.java From dremio-oss with Apache License 2.0 | 5 votes |
/** * Convert fs path to list of strings. * /a/b/c -> [a,b,c] * @param fsPath a string * @return list of path components */ public static List<String> toPathComponents(String fsPath) { if (fsPath == null ) { return EMPTY_SCHEMA_PATHS; } final StrTokenizer tokenizer = new StrTokenizer(fsPath, SLASH_CHAR, SqlUtils.QUOTE).setIgnoreEmptyTokens(true); return tokenizer.getTokenList(); }
Example 3
Source File: CommandCompleter.java From attic-stratos with Apache License 2.0 | 4 votes |
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { if (buffer.contains(CliConstants.RESOURCE_PATH_LONG_OPTION)) { return fileNameCompleter.complete(buffer, cursor, candidates); } if (logger.isTraceEnabled()) { logger.trace("Buffer: {}, cursor: {}", buffer, cursor); logger.trace("Candidates {}", candidates); } if (StringUtils.isNotBlank(buffer)) { // User is typing a command StrTokenizer strTokenizer = new StrTokenizer(buffer); String action = strTokenizer.next(); Collection<String> arguments = argumentMap.get(action); if (arguments != null) { if (logger.isTraceEnabled()) { logger.trace("Arguments found for {}, Tokens: {}", action, strTokenizer.getTokenList()); logger.trace("Arguments for {}: {}", action, arguments); } List<String> args = new ArrayList<String>(arguments); List<Completer> completers = new ArrayList<Completer>(); for (String token : strTokenizer.getTokenList()) { boolean argContains = arguments.contains(token); if (token.startsWith("-") && !argContains) { continue; } if (argContains) { if (logger.isTraceEnabled()) { logger.trace("Removing argument {}", token); } args.remove(token); } completers.add(new StringsCompleter(token)); } completers.add(new StringsCompleter(args)); Completer completer = new ArgumentCompleter(completers); return completer.complete(buffer, cursor, candidates); } else if (CliConstants.HELP_ACTION.equals(action)) { // For help action, we need to display available commands as arguments return helpCommandCompleter.complete(buffer, cursor, candidates); } } if (logger.isTraceEnabled()) { logger.trace("Using Default Completer..."); } return defaultCommandCompleter.complete(buffer, cursor, candidates); }
Example 4
Source File: PathUtils.java From dremio-oss with Apache License 2.0 | 2 votes |
/** * Parase a fully qualified dotted schema path to list of strings. * a.b.`c.json` -> [a,b,c.json] * a.b.`c-1` -> [a,b,c-1] * a.b.c -> [a,b,c] * @param path dotted schema path * @return list of path components. */ public static List<String> parseFullPath(final String path) { final StrTokenizer tokenizer = new StrTokenizer(path, PATH_DELIMITER, SqlUtils.QUOTE).setIgnoreEmptyTokens(true); return tokenizer.getTokenList(); }
Example 5
Source File: PathUtils.java From dremio-oss with Apache License 2.0 | 2 votes |
/** * Parase a fully qualified dotted schema path to list of strings. * a.b.`c.json` -> [a,b,c.json] * a.b.`c-1` -> [a,b,c-1] * a.b.c -> [a,b,c] * @param path dotted schema path * @return list of path components. */ public static List<String> parseFullPath(final String path) { final StrTokenizer tokenizer = new StrTokenizer(path, PATH_DELIMITER, SqlUtils.QUOTE).setIgnoreEmptyTokens(true); return tokenizer.getTokenList(); }