当前位置: 首页>>代码示例>>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;未经允许,请勿转载。