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.bstek.dorado.data.provider.filter.AdvanceFilterCriterionParser.java

public Criterion createFilterCriterion(String property, DataType dataType, String expression) throws Exception {
    if (StringUtils.isEmpty(expression)) {
        return null;
    }/*from ww  w. j a  v  a  2 s.  c o  m*/

    SingleValueFilterCriterion filterCriterion = new SingleValueFilterCriterion();
    filterCriterion.setProperty(property);
    filterCriterion.setDataType(dataType);
    filterCriterion.setExpression(expression);

    for (FilterCriterionProcessor processor : criterionProcessors) {
        processor.doProcess(filterCriterion);
        if (filterCriterion.getFilterOperator() != null) {
            return filterCriterion;
        }
    }

    throw new IllegalArgumentException("Unsupported expression [" + expression + "]");
}

From source file:com.dianping.wed.cache.redis.swallow.RedisConfMemoryCacheClearListener.java

@Override
public void onMessage(Message message) throws BackoutMessageException {
    String content = message.getContent();
    if (StringUtils.isEmpty(content)) {
        logger.error("message content null");
        return;/*from   ww  w.  j a  va  2 s  .c  om*/
    }

    //JSONObject contentObj = new JSONObject()
    JSONObject contentObj = new JSONObject(content);
    Object keyObj = contentObj.get("keys");
    if (keyObj == null) {
        logger.error("message content : key null");
        return;
    }

    String key = keyObj.toString();
    wcsWeddingRedisKeyCfgService.clearMemoryCache(key.split(","));
}

From source file:com.intel.cosbench.config.Storage.java

public void setType(String type) {
    if (StringUtils.isEmpty(type))
        throw new ConfigException("storage type cannot be empty");
    this.type = type;
}

From source file:com.microsoft.alm.plugin.idea.common.ui.workitem.SelectWorkItemsDialog.java

@Override
protected ValidationInfo doValidate() {
    if (StringUtils.isEmpty(getComment())) {
        return new ValidationInfo(
                TfPluginBundle.message(TfPluginBundle.KEY_WIT_SELECT_DIALOG_ERRORS_WORK_ITEM_NOT_SELECTED));
    }/*from w w w .  ja va 2 s .c o m*/

    return super.doValidate();
}

From source file:com.alibaba.cobar.manager.util.CobarStringUtil.java

/**
 * @return negative number if there is no common start from left side, or
 *         any of the string is empty/*from   w w w .  j ava2  s .c  o m*/
 */
private static int indexOfLastEqualCharacter(String str1, String str2) {
    if (StringUtils.isEmpty(str1) || StringUtils.isEmpty(str2))
        return -1;
    String shortOne = (str1.length() < str2.length()) ? str1 : str2;
    String longOne = (str2 == shortOne) ? str1 : str2;
    final int shortSize = shortOne.length();
    for (int i = 0; i < shortSize; ++i) {
        char cs = shortOne.charAt(i);
        char cl = longOne.charAt(i);
        if (cs != cl)
            return i - 1;
    }
    return shortOne.length() - 1;
}

From source file:com.floreantpos.util.GlobalConfigUtil.java

public static String getMapApiKey() {
    String mapApiKey = getValue(GlobalConfig.MAP_API_KEY);
    if (StringUtils.isEmpty(mapApiKey)) {
        return "AIzaSyDc-5LFTSC-bB9kQcZkM74LHUxwndRy_XM";
    }/*from  w  w w.j  av  a 2  s  .c  o  m*/
    return mapApiKey;
}

From source file:com.clican.pluto.dataprocess.spring.parser.TimerProcessorParser.java

@SuppressWarnings("unchecked")

public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    String cronExpression = element.getAttribute("cronExpression");
    String startTime = element.getAttribute("startTime");
    String endTime = element.getAttribute("endTime");
    String taskScheduler = element.getAttribute("taskScheduler");
    String concurrent = element.getAttribute("concurrent");
    if (StringUtils.isEmpty(taskScheduler)) {
        taskScheduler = "taskScheduler";
    }/*from www.  jav  a2  s. c  om*/
    String stepCommit = element.getAttribute("stepCommit");
    if (StringUtils.isNotEmpty(stepCommit)) {
        beanDef.getPropertyValues().addPropertyValue("stepCommit", Boolean.parseBoolean(stepCommit));
    }
    beanDef.getPropertyValues().addPropertyValue("cronExpression", cronExpression);
    beanDef.getPropertyValues().addPropertyValue("startTime", startTime);
    beanDef.getPropertyValues().addPropertyValue("endTime", endTime);
    beanDef.getPropertyValues().addPropertyValue("taskScheduler", new RuntimeBeanReference(taskScheduler));
    if (StringUtils.isNotEmpty(concurrent)) {
        beanDef.getPropertyValues().addPropertyValue("concurrent", Boolean.parseBoolean(concurrent));
    }
    String[] timerProcessors = element.getAttribute("timerProcessors").split(",");
    List partitionProcessorList = new ManagedList();
    for (String timerProcessor : timerProcessors) {
        partitionProcessorList.add(new RuntimeBeanReference(timerProcessor.trim()));
    }
    beanDef.getPropertyValues().addPropertyValue("timerProcessors", partitionProcessorList);

}

From source file:com.daimler.spm.storefront.util.QuoteExpirationTimeConverter.java

/**
 * Converts quote expiration time from {@link String} to {@link Date} by adjusting the time part to end of day
 * (23:59:59)./* w  w w .j  av a 2 s  .  com*/
 *
 * @param date
 *           the string representation of quote expiration time
 * @param pattern
 *           the date pattern to be used for conversion
 * @param locale
 *           the locale to be used for conversion
 * @return null if the string representation of expiration time is null or empty, otherwise the {@link Date} object
 */
public static Date convertStringToDate(final String date, final String pattern, final Locale locale) {
    if (StringUtils.isEmpty(date)) {
        return null;
    }

    final SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale);

    try {
        return QuoteExpirationTimeUtils.getEndOfDay(dateFormat.parse(date));
    } catch (final ParseException e) {
        throw new IllegalArgumentException(
                String.format("Failed to parse date [%s] using [%s] parsing format.", date, pattern), e);
    }
}

From source file:com.cy.swp.common.util.ValidateUtil.java

/**
 * ???/*w ww .  j  a v  a2  s. c om*/
 * @param carNumber
 * @return
 */

public static boolean validateCarNumber(String carNumber) {
    if (StringUtils.isEmpty(carNumber)) {
        return false;
    }
    Pattern pattern = Pattern.compile(
            "^[\u4e00-\u9fa5]{1}[a-zA-Z]{1}[a-zA-Z_0-9]{4}[a-zA-Z_0-9_\u4e00-\u9fa5]$|^[a-zA-Z]{2}\\d{7}$");
    Matcher macher = pattern.matcher(carNumber);
    return macher.matches();
}

From source file:com.dp2345.controller.admin.ProfileController.java

/**
 * ???/*w  w w .  j  ava2  s.  com*/
 */
@RequestMapping(value = "/check_current_password", method = RequestMethod.GET)
public @ResponseBody boolean checkCurrentPassword(String currentPassword) {
    if (StringUtils.isEmpty(currentPassword)) {
        return false;
    }
    Admin admin = adminService.getCurrent();
    if (StringUtils.equals(DigestUtils.md5Hex(currentPassword), admin.getPassword())) {
        return true;
    } else {
        return false;
    }
}