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

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

Introduction

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

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

Checks if a String is empty ("") or null.

Usage

From source file:com.intuit.tank.harness.functions.DateFunctions.java

/**
 * Is this a valid Date function request
 * /* w  w w . ja va 2  s . c o  m*/
 * @param values
 *            The command
 * @return TRUE if valid format; FALSE otherwise
 */
static public boolean isValid(String[] values) {
    try {
        if (values[2].equalsIgnoreCase("currentdate")) {
            return true;
        } else if (values[2].equalsIgnoreCase("adddays")) {
            if (!StringUtils.isEmpty(values[3])) {
                return true;
            }
        }
        return false;
    } catch (Exception ex) {
        return false;
    }
}

From source file:com.adaptris.core.util.Args.java

/**
 * Convenience to throw an {@link IllegalArgumentException} if the associated argument is the
 * empty string (or null) as defined by {@link StringUtils#isEmpty(String)}.
 * /*  w ww  . j av a 2s .c  o m*/
 * @param argument the argument.
 * @param member the member name associated with this argument.
 * @return the argument
 */
public static String notEmpty(String argument, final String member) {
    if (StringUtils.isEmpty(argument)) {
        throw new IllegalArgumentException(member + " is empty/null");
    }
    return argument;
}

From source file:gov.nih.nci.cabig.caaers.validation.fields.validators.ZipCodeValidator.java

@Override
public boolean isValid(Object fieldValue) {
    if (fieldValue == null || StringUtils.isEmpty(fieldValue.toString()))
        return true;
    return fieldValue.toString().matches("\\d{5}(-\\d{4})?");
}

From source file:net.servicefixture.context.GlobalContext.java

/**
 * Stores the context of test table indentified by testTableKey in the
 * global context.//from ww  w. j a va 2  s . c o  m
 */
@SuppressWarnings("unchecked")
public static void storeTableContext(String testTableKey, TableContext context) {
    if (!StringUtils.isEmpty(testTableKey)) {
        jexlContext.getVars().put(testTableKey, context);
    }
}

From source file:com.baifendian.swordfish.execserver.parameter.ParamHelper.java

/**
 * ????/*from ww  w .j av a2 s . c  o m*/
 *
 * @param text ?,  ${sf.sytem.cyctime}
 * @param paramMap ?,  sf.system.cyctime -> 20170308201820, v1 -> hello,world 
 * @return
 */
public static String resolvePlaceholders(String text, Map<String, String> paramMap) {
    if (StringUtils.isEmpty(text)) {
        return text;
    }

    // ?, 
    String cycTimeStr = paramMap.get(SystemParamManager.CYC_TIME);
    Date cycTime = getCycTime(cycTimeStr);

    // ? ${...} ?, ?????, ???
    text = PlaceholderUtil.resolvePlaceholders(text, paramMap, true);

    // ??: $[...],  $[yyyyMMddHHmmss], $[add_months(yyyyMMdd,12*N)]
    if (cycTime != null) {
        text = TimePlaceholderUtil.resolvePlaceholders(text, cycTime, true);
    }

    return text;
}

From source file:net.mitnet.tools.pdf.book.conf.ConfigHelper.java

public static Rectangle parsePageSize(CommandLineHelper commandLineHelper) {

    Rectangle pageSize = PdfPageSizeHelper.getDefaultPageSizeByLocale();
    if (commandLineHelper.hasOption(CliOptions.OPTION_PAGE_SIZE)) {
        String pageSizeValue = commandLineHelper.getOptionValue(CliOptions.OPTION_PAGE_SIZE);
        System.out.println("Page Size Option Detected: " + pageSizeValue);
        if (!StringUtils.isEmpty(pageSizeValue)) {
            if (PdfPageValues.PAGE_SIZE_US_LETTER_STRING.equalsIgnoreCase(pageSizeValue)) {
                System.out.println("Setting Page Size to Letter");
                pageSize = PageSize.LETTER;
            }//from   w w  w .  j ava  2  s  .co  m
        }
    }
    return pageSize;
}

From source file:de.fhg.iais.asc.ui.i18n.LocalizedUI.java

public static JButton createButton(String key, ActionListener listener) {
    key = "Button." + key;
    String tooltipText = Messages.getString("Tooltip." + key, "");

    JButton button = new JButton(Messages.getString(key));
    if (!StringUtils.isEmpty(tooltipText)) {
        button.setToolTipText(tooltipText);
    }// w ww.j av a2s  .c om

    if (listener != null) {
        button.addActionListener(listener);
    }

    return button;
}

From source file:com.stevpet.sonar.plugins.dotnet.mscover.commandexecutor.CommandHelper.java

/**
 * Put parenthesis around each of the elements i.e. 'joa Jewel' results in '"joa Jewel"'
 * @param elements/*  www  .  ja v a 2 s .c  om*/
 * @return
 */
public static List<String> parenthesizeArguments(List<String> elements) {
    List<String> parenthesized = new ArrayList<String>();
    if (elements == null) {
        return parenthesized;
    }
    for (String str : elements) {
        if (!StringUtils.isEmpty(str)) {
            String escapedPath = "\"" + str + "\"";
            parenthesized.add(escapedPath);
        }
    }
    return parenthesized;
}

From source file:com.nec.harvest.util.StringUtil.java

/**
 * Remove comma character in a string/*  w w w .  jav  a  2 s.co  m*/
 * 
 * @param text
 * @return
 */
public static String removeCommaChar(String text) {
    if (StringUtils.isEmpty(text)) {
        return StringUtils.EMPTY;
    }

    return text.replaceAll(",", StringUtils.EMPTY);
}

From source file:net.shopxx.StringEditor.java

@Override
public void setAsText(String text) {
    if (emptyAsNull && StringUtils.isEmpty(text)) {
        setValue(null);//from   ww  w . jav  a2 s  .  c o m
    } else {
        setValue(text);
    }
}