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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:net.duckling.ddl.util.ClientValidator.java

public static String getRealIp(HttpServletRequest request) {
    String nginxIp = request.getHeader("x-real-ip");
    if (StringUtils.isNotEmpty(nginxIp)) {
        return nginxIp;
    }/*from  w w  w.  jav  a  2 s  . c o m*/
    return request.getRemoteAddr();
}

From source file:com.haulmont.cuba.desktop.gui.data.DesktopContainerHelper.java

public static boolean hasExternalCaption(Component component) {
    if (component instanceof Field && !(component instanceof DesktopCheckBox)) {
        final String caption = ((Field) component).getCaption();
        if (StringUtils.isNotEmpty(caption)) {
            return true;
        }// w w w .  j  a va  2s  .  c o m
    }
    return false;
}

From source file:com.google.gplus.serializer.util.GPlusEventClassifier.java

public static Class detectClass(String json) {
    Preconditions.checkNotNull(json);/*from w ww  .j a  v  a 2s  .com*/
    Preconditions.checkArgument(StringUtils.isNotEmpty(json));

    ObjectNode objectNode;
    try {
        objectNode = (ObjectNode) mapper.readTree(json);
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }

    if (objectNode.findValue("kind") != null && objectNode.get("kind").toString().equals(ACTIVITY_IDENTIFIER)) {
        return Activity.class;
    } else if (objectNode.findValue("kind") != null
            && objectNode.get("kind").toString().equals(PERSON_IDENTIFIER)) {
        return Person.class;
    } else {
        return ObjectNode.class;
    }
}

From source file:de.javakaffee.sandbox.getfj.OptionDemo.java

static void createDemo(final String value1, final String value2) {
    final Option<Integer> option = Option.some(1);
    final Option<Integer> none = Option.none();
    final Option<String> o1 = Option.iif(StringUtils.isNotEmpty(value1), value1);
    final Option<String> o2 = Option.iif(Strings.isNotNullOrEmpty, value2);
    final String foo = o1.isSome() ? o1.some() : "<isEmpty>";
    LOGGER.info("Have o1: {}", o1.orSome("<isEmpty>"));
    LOGGER.info("One of o1 or o2 is not empty: {}", o1.orElse(o2).isSome());
}

From source file:com.enonic.cms.business.localization.resource.LocalizationResourceBundleUtils.java

public static String createLocaleString(Locale locale) {
    String localeString = locale.getLanguage();

    return StringUtils.isNotEmpty(locale.getCountry()) ? localeString + "-" + locale.getCountry()
            : localeString;/*from w  w  w.  j a va2  s.  co m*/
}

From source file:com.leosys.core.utils.HttpServiceImpl.java

public static String getMyitem(String letter, Integer page) {
    Properties p = new Properties();
    String urls = getXmlPath();//from www  . ja v a2 s  . c  o  m
    try {
        p.load(new FileInputStream(urls));
    } catch (Exception e) {
        e.printStackTrace();
    }
    String subUrl = p.getProperty("path");
    String restUrl = subUrl + "model=myservice&action=getwebdomainsitebypage&page=" + page + "&pagesize=10";
    if (StringUtils.isNotEmpty(letter)) {
        restUrl += "&letter=" + letter;
    }
    StringBuffer strBuf;
    strBuf = new StringBuffer();

    try {
        URL url = new URL(restUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("POST");
        BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));//?  
        String line = null;
        while ((line = reader.readLine()) != null)
            strBuf.append(line + " ");
        reader.close();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    System.out.println(strBuf.toString());
    return strBuf.toString();
}

From source file:com.evolveum.midpoint.web.component.wizard.resource.dto.ConnectorHostTypeComparator.java

public static String getUserFriendlyName(PrismObject<ConnectorHostType> host) {
    if (host == null) {
        return null;
    }//from   ww w  .java2  s .com

    String name = WebMiscUtil.getName(host);

    StringBuilder builder = new StringBuilder();
    if (StringUtils.isNotEmpty(name)) {
        builder.append(name);
        builder.append('(');
    }
    builder.append(getStringProperty(host, ConnectorHostType.F_HOSTNAME));

    String port = getStringProperty(host, ConnectorHostType.F_PORT);
    if (StringUtils.isNotEmpty(port)) {
        builder.append(':');
        builder.append(port);
    }
    if (StringUtils.isNotEmpty(name)) {
        builder.append(')');
    }

    return builder.toString();
}

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

public void gotoLink(final String url) {
    if (StringUtils.isNotEmpty(url)) {
        BrowserUtil.browse(url);
    }
}

From source file:com.nec.harvest.provider.PageTitleProvider.java

/**
 * Get the title of page for every HTTP Request
 * // ww  w.  j  a v  a  2 s  .com
 * @return
 */
public String getTitle() {
    final String title = (String) getRequest().getAttribute(BaseController.TITLE);
    if (StringUtils.isNotEmpty(title)) {
        return title;
    }
    return StringUtils.EMPTY;
}

From source file:com.googlecode.jtiger.modules.ecside.core.bean.TableDefaults.java

static String getTableId(String tableId) {
    if (StringUtils.isNotEmpty(tableId)) {
        return tableId;
    }//ww w.  j  av a 2s .c  o m

    return TableConstants.EXTREME_COMPONENTS;
}