當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.containsAny方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.StringUtils.containsAny方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.containsAny方法的具體用法?Java StringUtils.containsAny怎麽用?Java StringUtils.containsAny使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.containsAny方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: delete

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected Exit delete(final SessionPool session, final Path remote) throws BackgroundException {
    final List<Path> files = new ArrayList<Path>();
    for(TransferItem i : new DeletePathFinder().find(input, TerminalAction.delete, remote)) {
        files.add(i.remote);
    }
    final DeleteWorker worker;
    if(StringUtils.containsAny(remote.getName(), '*')) {
        worker = new DeleteWorker(new TerminalLoginCallback(reader), files, cache, new DownloadGlobFilter(remote.getName()), progress);
    }
    else {
        worker = new DeleteWorker(new TerminalLoginCallback(reader), files, cache, progress);
    }
    final SessionBackgroundAction<List<Path>> action = new TerminalBackgroundAction<List<Path>>(controller, session, worker);
    if(!this.execute(action)) {
        return Exit.failure;
    }
    return Exit.success;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:19,代碼來源:Terminal.java

示例2: find

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public Set<TransferItem> find(final CommandLine input, final TerminalAction action, final Path remote) {
    final Local local = LocalFactory.get(input.getOptionValues(action.name())[1]);
    if(StringUtils.containsAny(remote.getName(), '*')) {
        // Treat asterisk as wildcard
        return Collections.singleton(new TransferItem(remote.getParent(), local));
    }
    if(remote.isDirectory()) {
        // Remote path resolves to directory
        if(local.exists()) {
            return Collections.singleton(new TransferItem(remote, LocalFactory.get(local, remote.getName())));
        }
        return Collections.singleton(new TransferItem(remote, local));
    }
    // Remote path resolves to file
    if(local.isDirectory()) {
        // Append remote filename to local target
        return Collections.singleton(new TransferItem(remote, LocalFactory.get(local, remote.getName())));
    }
    // Keep from input
    return Collections.singleton(new TransferItem(remote, local));
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:23,代碼來源:DownloadTransferItemFinder.java

示例3: find

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public Set<TransferItem> find(final CommandLine input, final TerminalAction action, final Path remote) throws AccessDeniedException {
    if(StringUtils.containsAny(remote.getName(), '*')) {
        // Treat asterisk as wildcard
        return Collections.singleton(new TransferItem(remote.getParent()));
    }
    return Collections.singleton(new TransferItem(remote));
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:9,代碼來源:DeletePathFinder.java

示例4: create

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public Transfer create(final CommandLine input, final Host host, final Path remote, final List<TransferItem> items)
        throws BackgroundException {
    final Transfer transfer;
    final TerminalAction type = TerminalActionFinder.get(input);
    if(null == type) {
        throw new BackgroundException(LocaleFactory.localizedString("Unknown"), "Unknown transfer type");
    }
    switch(type) {
        case download:
            if(StringUtils.containsAny(remote.getName(), '*')) {
                transfer = new DownloadTransfer(host, items, new DownloadGlobFilter(remote.getName()));
            }
            else {
                transfer = new DownloadTransfer(host, items);
            }
            break;
        case upload:
            transfer = new UploadTransfer(host, items);
            break;
        case synchronize:
            transfer = new SyncTransfer(host, items.iterator().next());
            break;
        default:
            throw new BackgroundException(LocaleFactory.localizedString("Unknown"),
                    String.format("Unknown transfer type %s", type.name()));
    }
    if(input.hasOption(TerminalOptionsBuilder.Params.throttle.name())) {
        try {
            transfer.setBandwidth(Float.valueOf(input.getOptionValue(TerminalOptionsBuilder.Params.throttle.name())));
        }
        catch(NumberFormatException ignore) {
            //
        }
    }
    return transfer;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:37,代碼來源:TerminalTransferFactory.java

示例5: getTimeOfDayDescription

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * @param expressionParts
 * @return
 */
private static String getTimeOfDayDescription(String[] expressionParts) {
    String secondsExpression = expressionParts[0];
    String minutesExpression = expressionParts[1];
    String hoursExpression = expressionParts[2];
    StringBuilder description = new StringBuilder();
    // Handle special cases first
    if (!StringUtils.containsAny(minutesExpression, specialCharacters) && !StringUtils.containsAny(hoursExpression, specialCharacters) && !StringUtils.containsAny(secondsExpression, specialCharacters)) {
        description.append(I18nMessages.get("at")).append(" ").append(DateAndTimeUtils.formatTime(hoursExpression, minutesExpression, secondsExpression)); // Specific time of day (e.g. 10 14)
    } else if (minutesExpression.contains("-") && !minutesExpression.contains("/") && !StringUtils.containsAny(hoursExpression, specialCharacters)) {
        // Minute range in single hour (e.g. 0-10 11)
        String[] minuteParts = minutesExpression.split("-");
        description.append(MessageFormat.format(I18nMessages.get("every_minute_between"), DateAndTimeUtils.formatTime(hoursExpression, minuteParts[0]),
            DateAndTimeUtils.formatTime(hoursExpression, minuteParts[1])));
    } else if (hoursExpression.contains(",") && !StringUtils.containsAny(minutesExpression, specialCharacters)) {
        // Hours list with single minute (e.g. 30 6,14,16)
        String[] hourParts = hoursExpression.split(",");
        description.append(I18nMessages.get("at"));
        for (int i = 0; i < hourParts.length; i++) {
            description.append(" ").append(DateAndTimeUtils.formatTime(hourParts[i], minutesExpression));
            if (i < hourParts.length - 2) {
                description.append(",");
            }
            if (i == hourParts.length - 2) {
                description.append(" ");
                description.append(I18nMessages.get("and"));
            }
        }
    } else {
        String secondsDescription = getSecondsDescription(expressionParts);
        String minutesDescription = getMinutesDescription(expressionParts);
        String hoursDescription = getHoursDescription(expressionParts);
        description.append(secondsDescription);
        if (description.length() > 0 && StringUtils.isNotEmpty(minutesDescription)) {
            description.append(", ");
        }
        description.append(minutesDescription);
        if (description.length() > 0 && StringUtils.isNotEmpty(hoursDescription)) {
            description.append(", ");
        }
        description.append(hoursDescription);
    }
    return description.toString();
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:48,代碼來源:CronExpressionDescriptor.java

示例6: hasAction

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private boolean hasAction(MockRequest request, String... action) {
  String requestAction = request.getBodyParameters().get(S3RequestTransformer.ACTION);
  return StringUtils.containsAny(requestAction, action);
}
 
開發者ID:daflockinger,項目名稱:unitstack,代碼行數:5,代碼來源:S3ActionInvestigator.java

示例7: validFileName

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * Check if the given file name is a valid file name. Return false if any of
 * the characters in the file name has [email protected]#$%^&*()
 *
 * @param fileName
 * @return
 */
public boolean validFileName(String fileName) {
    boolean validFlag = !StringUtils.containsAny(fileName, "[email protected]#$%^&*");
    log.info("Inside validFileName method of FileNameUtils:: fileName: " + fileName + "validFlag: " + validFlag);
    return validFlag;
}
 
開發者ID:Mahidharmullapudi,項目名稱:timesheet-upload,代碼行數:13,代碼來源:FileNameUtils.java


注:本文中的org.apache.commons.lang3.StringUtils.containsAny方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。