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

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

Introduction

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

Prototype

public static boolean equals(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal.

Usage

From source file:io.github.jeddict.snippet.Snippet.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*from  ww w  .  j a v  a  2s .  c  o m*/
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof Snippet)) {
        return false;
    }
    final Snippet other = (Snippet) obj;
    if (this.getLocationType() != other.getLocationType()) {
        return false;
    }
    return StringUtils.equals(deleteWhitespace(this.getValue()), deleteWhitespace(other.getValue()));
}

From source file:com.junly.service.helper.TicketHelper.java

/** <p class="detail">
* ???ticket/*from   w w  w  .  j  a  v a2 s.  c  om*/
* </p>
* @author junly
* @date 2017324 
* @param request
* @param httpChannelType
* @return    
*/
public String getTicket(HttpServletRequest request, HttpChannelType httpChannelType) {

    Cookie cookies[] = request.getCookies();

    String ticket = null;

    if (null != cookies) {
        for (Cookie cookie : cookies) {
            if (StringUtils.equals(ViewContants.LOGIN_TICKET_KEY, cookie.getName())) {

                ticket = StringUtils.trim(cookie.getValue());

                StringBuilder builder = new StringBuilder(httpChannelType.name());
                builder.append("?cookieticket=").append(ticket);
                builder.append("?=").append(request.getServerName()).append("====");
                builder.append(cookie.getDomain());
                logger.info(builder.toString());

                break;
            }
        }
    }

    // java??cookieheader???,
    // ???cookie? ??
    if (StringUtils.isBlank(ticket)) {
        ticket = customHeadTicket(request, httpChannelType);
    }

    if (StringUtils.isBlank(ticket)) {
        ticket = StringUtils.trim(request.getParameter(ViewContants.LOGIN_TICKET_KEY));
    }

    return ticket;
}

From source file:com.sfs.beans.DetectBrowserBean.java

/**
 * Returns a boolean indicating whether the browser is a legacy version of IE.
 *
 * @return the boolean for the legacy IE flag
 *//*www.  j a v  a  2  s  . com*/
public boolean isLegacyIE() {
    boolean legacy = false;

    if (StringUtils.equals(this.version, "ie6") || StringUtils.equals(this.version, "ie7")) {
        legacy = true;
    }
    return legacy;
}

From source file:com.htmlhifive.tools.jslint.JSLintPlugin.java

/**
 * ?JSLint?????????????./* w ww  .j a  va 2s  .  co m*/
 * 
 * @param project ?.
 * @return JSLint???????????.
 */
public static boolean hasJSLintNature(IProject project) {
    try {
        IProjectDescription description = project.getDescription();
        String[] natureIds = description.getNatureIds();
        for (String string : natureIds) {
            if (StringUtils.equals(JSLintPluginNature.NATURE_ID, string)) {
                return true;
            }
        }
    } catch (CoreException e) {
        logger.put(Messages.EM0011, project.getName());
    }
    return false;
}

From source file:hydrograph.ui.graph.execution.tracking.preferences.JobRunPreference.java

@Override
public void init(IWorkbench workbench) {
    getPreferenceStore().setDefault(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT);
    getPreferenceStore().setDefault(LOG_LEVEL_PREFERENCE, DEFUALT_LOG_LEVEL);
    String value = Activator.getDefault().getPreferenceStore().getString(SAVE_JOB_BEFORE_RUN_PREFRENCE);
    if (StringUtils.equals(MessageDialogWithToggle.ALWAYS, value)) {
        getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, value);
    } else {/* w w w  .j a v  a 2  s  .  c o m*/
        getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT);
    }

    String log_level_value = Activator.getDefault().getPreferenceStore()
            .getString(JobRunPreference.LOG_LEVEL_PREFERENCE);

    if (StringUtils.isNotBlank(log_level_value)) {
        getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, log_level_value);
    } else {
        getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, DEFUALT_LOG_LEVEL);
    }

    String consoleBufferValue = Activator.getDefault().getPreferenceStore()
            .getString(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME);
    if (StringUtils.isNotBlank(consoleBufferValue)) {
        getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME, consoleBufferValue);
    } else {
        getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME,
                Constants.DEFUALT_CONSOLE_BUFFER_SIZE);
    }
}

From source file:io.udvi.amqp.mq.transport.endpoint.MessagePropertiesImpl.java

static MessagePropertiesImpl decode(CAMQPSyncDecoder decoder) {
    String symbolRead = decoder.readSymbol();
    assert (StringUtils.equals(symbolRead, CAMQPDefinitionProperties.descriptor));
    CAMQPDefinitionProperties properties = CAMQPDefinitionProperties.decode(decoder);
    return new MessagePropertiesImpl(properties);
}

From source file:com.goosby.virgo.utils.PageRequest.java

/**
 * ???./*  w w  w  .jav  a 2  s  .  c o m*/
 * 
 * @param orderDir ?descasc,?','.
 */
public void setOrderDir(final String orderDir) {
    final String lowcaseOrderDir = StringUtils.lowerCase(orderDir);

    // order?
    final String[] orderDirs = StringUtils.split(lowcaseOrderDir, ',');
    for (final String orderDirStr : orderDirs) {
        if (!StringUtils.equals(Sort.DESC, orderDirStr) && !StringUtils.equals(Sort.ASC, orderDirStr))
            throw new IllegalArgumentException("??" + orderDirStr + "??");
    }

    this.orderDir = lowcaseOrderDir;
}

From source file:gov.nih.nci.cabig.caaers.domain.MetastaticDiseaseSite.java

/**
 * Equals.//  w  w w  .  ja v a 2s. co  m
 *
 * @param codedSite the coded site
 * @param otherSite the other site
 * @return true, if successful
 */
public boolean equals(AnatomicSite codedSite, String otherSite) {
    return StringUtils.equals(this.otherSite, otherSite) && ObjectUtils.equals(codedSite, this.codedSite);
}

From source file:edu.duke.cabig.c3pr.webservice.integration.XMLUtils.java

/**
 * @param n1//from  w  ww.  jav  a 2s . c o  m
 * @param n2
 * @return
 */
private static boolean isTextNodeEqual(Node n1, Node n2) {
    final String v1 = StringUtils.trim(normalize(n1.getNodeValue() + ""));
    final String v2 = StringUtils.trim(normalize(n2.getNodeValue() + ""));
    final boolean eq = StringUtils.equals(v1, v2);
    if (!eq) {
        log.info("Text nodes are not equal: " + v1 + " and " + v2);
    }
    return eq;

}

From source file:com.webtide.jetty.load.generator.jenkins.LoadGeneratorProcessRunner.java

public void runProcess(TaskListener taskListener, FilePath workspace, Launcher launcher, String jdkName, //
        Node currentNode, List<Resource.NodeListener> nodeListeners, //
        List<LoadGenerator.Listener> loadGeneratorListeners, //
        List<String> args, String jvmExtraArgs, String alpnVersion, //
        Map<String, String> jdkVersionAlpnBootVersions) throws Exception {

    Channel channel = null;/*from w ww. j av a 2 s  .c om*/

    try {
        long start = System.nanoTime();

        JDK jdk = StringUtils.isEmpty(jdkName) ? //
                null : Jenkins.getInstance().getJDK(jdkName).forNode(currentNode, taskListener);

        channel = new LoadGeneratorProcessFactory().buildChannel(taskListener, jdk, workspace, launcher,
                jvmExtraArgs);

        // alpn version from jdk
        if (StringUtils.isEmpty(alpnVersion) && !StringUtils.equals(alpnVersion, "N/A")) {

            String javaVersion = findJavaVersion(channel, taskListener);
            alpnVersion = jdkVersionAlpnBootVersions.get(javaVersion);
            // download alpn jar
        }

        channel.call(new LoadCaller(args, nodeListeners, loadGeneratorListeners));

        long end = System.nanoTime();

        taskListener.getLogger().println("remote LoadGenerator execution done: " //
                + TimeUnit.NANOSECONDS.toMillis(end - start) //
                + " ms ");
    } finally {
        if (channel != null) {
            channel.close();
        }
    }

}