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

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

Introduction

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

Prototype

public static String trimToEmpty(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.prowidesoftware.swift.model.field.Field98K.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///from w  w w  .j av  a2  s.  c om
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(":");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent2()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    result.append("//");
    result.append(StringUtils.trimToEmpty(getComponent4()));
    result.append(StringUtils.trimToEmpty(getComponent5()));
    return result.toString();
}

From source file:com.thihy.jacoco.data.BundleCoverageDataWriter.java

private void writeClassCoverage(IClassCoverage classCoverage) {
    try {//  www  .java 2  s.c  o m
        //out.writeByte(BLOCK_CLASS_COVERAGE_DATA);
        writeSourceNode(classCoverage);
        out.writeLong(classCoverage.getId());
        out.writeUTF(StringUtils.trimToEmpty(classCoverage.getSignature()));
        out.writeUTF(StringUtils.trimToEmpty(classCoverage.getSuperName()));
        String[] interfaceNames = classCoverage.getInterfaceNames();
        if (interfaceNames == null) {
            out.writeVarInt(0);
        } else {
            out.writeVarInt(interfaceNames.length);
            for (int i = 0; i < interfaceNames.length; i++) {
                out.writeUTF(interfaceNames[i]);
            }
        }
        if (false) {
            out.writeUTF(classCoverage.getPackageName());
        }
        out.writeUTF(classCoverage.getSourceFileName());
        Collection<IMethodCoverage> methodCoverages = classCoverage.getMethods();
        if (methodCoverages == null || methodCoverages.isEmpty()) {
            out.writeVarInt(0);
        } else {
            out.writeVarInt(methodCoverages.size());
            for (IMethodCoverage methodCoverage : methodCoverages) {
                writeMethodCoverage(methodCoverage);
            }
        }
    } catch (final IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.edgenius.wiki.render.impl.LinkRenderHelperImpl.java

public ObjectPosition appendExtSpaceLink(StringBuffer buffer, String extSpaceUname, String link, String view) {
    extSpaceUname = StringUtils.trimToEmpty(extSpaceUname);
    link = StringUtils.trimToEmpty(link);
    view = StringUtils.trimToEmpty(view);

    ObjectPosition pos = new ObjectPosition("[" + view + "]");
    pos.serverHandler = LinkHandler.HANDLER;
    pos.uuid = context.createUniqueKey(false);
    pos.values.put(NameConstants.TYPE, String.valueOf(LinkModel.LINK_TO_VIEW_FLAG));
    pos.values.put(NameConstants.SPACE, extSpaceUname);
    pos.values.put(NameConstants.NAME, link);
    pos.values.put(NameConstants.VIEW, view);
    context.getObjectList().add(pos);/*from   w ww.  j a  v a 2s.  c  o m*/
    buffer.append(pos.uuid);
    return pos;
}

From source file:com.prowidesoftware.swift.model.field.Field77A.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///from  w  w  w.j a v  a2  s. c o m
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(StringUtils.trimToEmpty(getComponent1()));
    appendInLines(result, 2, 20);
    return result.toString();
}

From source file:com.prowidesoftware.swift.model.field.Field93B.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *//*www .j a  va2 s .  c  o  m*/
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(":");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("/");
    if (StringUtils.isNotEmpty(getComponent2())) {
        result.append(StringUtils.trimToEmpty(getComponent2()));
    }
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent4()));
    result.append(StringUtils.trimToEmpty(getComponent5()));
    return result.toString();
}

From source file:com.prowidesoftware.swift.model.field.Field93C.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///from   w  ww  .j  a  v  a  2  s . c o  m
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(":");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("//");
    result.append(StringUtils.trimToEmpty(getComponent2()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent4()));
    result.append(StringUtils.trimToEmpty(getComponent5()));
    return result.toString();
}

From source file:com.hangum.tadpole.engine.sql.util.SQLUtil.java

/**
 *  jdbc?    ./* w  ww .ja  v a 2  s. c  om*/
 * 
 * @param userDB
 * @param exeSQL
 * @return
 */
public static String makeExecutableSQL(UserDBDAO userDB, String exeSQL) {

    //      tmpStrSelText = UnicodeUtils.getUnicode(tmpStrSelText);

    //         https://github.com/hangum/TadpoleForDBTools/issues/140  .
    //         TO DO  ? ??  ??..DB?    ?   . 

    //  ? // ? ? ?? ? .
    /*
     *  mysql?  ?? , --  ? ? --   ? ??   ?. --comment ? ? ?? .( (mssql, oralce, pgsql)? ? ??)
     *   ,  ?? ??   ?? ??   . - 2013.11.11- (hangum)
     */

    exeSQL = StringUtils.trimToEmpty(exeSQL);

    // ?.
    // oracle, tibero, altibase?  ? ?  ??  .
    if (userDB.getDBDefine() == DBDefine.ORACLE_DEFAULT | userDB.getDBDefine() == DBDefine.TIBERO_DEFAULT
            | userDB.getDBDefine() == DBDefine.ALTIBASE_DEFAULT) {
        // ignore code
    } else {
        exeSQL = removeComment(exeSQL);
    }
    exeSQL = StringUtils.trimToEmpty(exeSQL);
    exeSQL = StringUtils.removeEnd(exeSQL, "/");
    exeSQL = StringUtils.trimToEmpty(exeSQL);
    //TO DO ?? ? ?  (;)  .  ?  .
    exeSQL = StringUtils.removeEnd(exeSQL, PublicTadpoleDefine.SQL_DELIMITER);

    return exeSQL;
}

From source file:com.prowidesoftware.swift.model.field.Field37A.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///w ww  .j ava2 s .  co m
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(StringUtils.trimToEmpty(getComponent1()));
    if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent2())
            || org.apache.commons.lang.StringUtils.isNotEmpty(getComponent3())
            || org.apache.commons.lang.StringUtils.isNotEmpty(getComponent4())) {
        result.append("//");
        if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent2())) {
            result.append(StringUtils.trimToEmpty(getComponent2()));
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent3())) {
            result.append(StringUtils.trimToEmpty(getComponent3()));
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent4())) {
            result.append(StringUtils.trimToEmpty(getComponent4()));
        }
    }
    if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent5())) {
        result.append("/");
        result.append(StringUtils.trimToEmpty(getComponent5()));
    }
    return result.toString();
}

From source file:com.haulmont.restapi.auth.CubaUserAuthenticationProvider.java

protected String makeClientInfo(String userAgent) {
    GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);

    //noinspection UnnecessaryLocalVariable
    String serverInfo = String.format("REST API (%s:%s/%s) %s", globalConfig.getWebHostName(),
            globalConfig.getWebPort(), globalConfig.getWebContextName(), StringUtils.trimToEmpty(userAgent));

    return serverInfo;
}

From source file:com.prowidesoftware.swift.model.field.Field70E.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *//* www.j a  v a 2 s  . c  o  m*/
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(":");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("//");
    result.append(StringUtils.trimToEmpty(getComponent2()));
    appendInLines(result, 3, 11);
    return result.toString();
}