Example usage for org.apache.commons.lang3 StringUtils trimToEmpty

List of usage examples for org.apache.commons.lang3 StringUtils trimToEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils trimToEmpty.

Prototype

public static String trimToEmpty(final String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null .

Usage

From source file:com.norconex.collector.core.pipeline.queue.ReferenceFiltersStageUtil.java

public static boolean resolveReferenceFilters(IReferenceFilter[] filters, BasePipelineContext ctx,
        String type) {/*from w  ww .  j a v a 2 s.  c o  m*/
    if (filters == null) {
        return false;
    }
    String msg = StringUtils.trimToEmpty(type);
    if (StringUtils.isNotBlank(msg)) {
        msg = " (" + msg + ")";
    }

    boolean hasIncludes = false;
    boolean atLeastOneIncludeMatch = false;
    for (IReferenceFilter filter : filters) {
        boolean accepted = filter.acceptReference(ctx.getCrawlData().getReference());

        // Deal with includes
        if (isIncludeFilter(filter)) {
            hasIncludes = true;
            if (accepted) {
                atLeastOneIncludeMatch = true;
            }
            continue;
        }

        // Deal with exclude and non-OnMatch filters
        if (accepted) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("ACCEPTED document reference" + msg + ". Reference="
                        + ctx.getCrawlData().getReference() + " Filter=" + filter);
            }
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("REJECTED document reference " + msg + ". Reference="
                        + ctx.getCrawlData().getReference() + " Filter=" + filter);
            }
            fireDocumentRejected(filter, ctx);
            return true;
        }
    }
    if (hasIncludes && !atLeastOneIncludeMatch) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("REJECTED document reference" + msg + ". No include filters matched. Reference="
                    + ctx.getCrawlData().getReference() + " Filter=[one or more filter 'onMatch' "
                    + "attribute is set to 'include', but none of them were " + "matched]");
        }
        fireDocumentRejected(null, ctx);
        return true;
    }
    return false;
}

From source file:io.lavagna.model.apihook.From.java

public static CardData from(io.lavagna.model.CardData data) {
    return new CardData(data.getType().toString(), StringUtils.trimToEmpty(data.getContent()));
}

From source file:com.creditcloud.payment.model.chinapnr.query.FssProductQueryResponse.java

@Override
public String chkString() {
    StringBuilder sb = new StringBuilder(baseChkString());
    sb.append(StringUtils.trimToEmpty(getAnnuRate())).append(StringUtils.trimToEmpty(getPrdRate()))
            .append(StringUtils.trimToEmpty(getRespExt()));
    return sb.toString();
}

From source file:com.creditcloud.payment.model.chinapnr.query.FssProductQueryRequest.java

@Override
public String chkString() {
    return baseChkString().concat(StringUtils.trimToEmpty(getReqExt()));
}

From source file:com.chessix.vas.service.AccountService.java

public String getAccountId(final String accountRefId) {
    return StringUtils.lowerCase(StringUtils.trimToEmpty(accountRefId));
}

From source file:com.creditcloud.payment.model.chinapnr.BgBindCardResponse.java

@Override
public String chkString() {
    StringBuilder sb = new StringBuilder();
    sb.append(super.baseChkString()).append(StringUtils.trimToEmpty(getOpenAcctId()))
            .append(StringUtils.trimToEmpty(getOpenBankId())).append(StringUtils.trimToEmpty(getMerPriv()));
    return sb.toString();
}

From source file:io.lavagna.model.apihook.From.java

public static CardData from(CardType type, CardDataHistory data) {
    return new CardData(type.toString(), StringUtils.trimToEmpty(data.getContent()));
}

From source file:com.creditcloud.payment.model.chinapnr.base.UserRequest.java

@Override
protected String baseChkString() {
    return super.baseChkString().concat(StringUtils.trimToEmpty(getUsrCustId()));
}

From source file:com.creditcloud.payment.model.chinapnr.query.FssAccountQueryResponse.java

@Override
public String chkString() {
    StringBuilder sb = new StringBuilder();
    sb.append(super.baseChkString()).append(StringUtils.trimToEmpty(getUsrCustId()))
            .append(StringUtils.trimToEmpty(getTotalAsset())).append(StringUtils.trimToEmpty(getTotalProfit()))
            .append(StringUtils.trimToEmpty(getRespExt()));
    return sb.toString();
}

From source file:kenh.expl.functions.Trim.java

public String process(String str) {
    return StringUtils.trimToEmpty(str);
}