Example usage for org.apache.commons.lang3 ObjectUtils notEqual

List of usage examples for org.apache.commons.lang3 ObjectUtils notEqual

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ObjectUtils notEqual.

Prototype

public static boolean notEqual(final Object object1, final Object object2) 

Source Link

Document

Compares two objects for inequality, where either one or both objects may be null .

 ObjectUtils.notEqual(null, null)                  = false ObjectUtils.notEqual(null, "")                    = true ObjectUtils.notEqual("", null)                    = true ObjectUtils.notEqual("", "")                      = false ObjectUtils.notEqual(Boolean.TRUE, null)          = true ObjectUtils.notEqual(Boolean.TRUE, "true")        = true ObjectUtils.notEqual(Boolean.TRUE, Boolean.TRUE)  = false ObjectUtils.notEqual(Boolean.TRUE, Boolean.FALSE) = true 

Usage

From source file:com.github.htfv.maven.plugins.buildconfigurator.core.configurators.plugins.StringMergeHelper.java

/**
 * Updates the given target {@link String} with the given source
 * {@link String}./*  w  w w .j  a v a 2s  . c o  m*/
 *
 * @param targetElement
 *            target {@link String}.
 * @param sourceElement
 *            source {@link String}.
 *
 * @return {@code true} if the given target and source objects may be
 *         considered equal.
 */
@Override
public boolean equals(final String targetElement, final String sourceElement) {
    final String sourceElementValue = ELUtils.getStringValue(elContext, sourceElement);

    if (ObjectUtils.notEqual(targetElement, sourceElementValue)) {
        return false;
    }

    return true;
}

From source file:com.github.boogey.progressview.swing.JProgressPanel.java

/**
 * Set or change manually the {@link IProgressModelRO}.
 * /*from   w w  w.  j  a  va  2s  .c  om*/
 * @param model <br>
 *            the model that will be showed of the {@link JPanel}.
 */
public void setModel(final IProgressModelRO model) {
    if (null != model && ObjectUtils.notEqual(this.model, model)) {
        if (null != this.model) {
            this.model.removePropertyChangeListener(progressListener);
            this.model.removePropertyChangeListener(messageListener);
        }
        progressListener = new ProgressPropertyListener(progressBar, model);
        messageListener = new MessagePropertyListener(messageLabel);

        this.model = model;
        this.model.addPropertyChangeListener(progressListener);
        this.model.addPropertyChangeListener(messageListener);

        progressBar.setMinimum(model.getMinimum());
        progressBar.setMaximum(model.getMaximum());
        progressBar.setIndeterminate(model.isIndeterminate());
        messageLabel.setText(model.getMessage());
    }
}

From source file:com.github.jgility.core.project.Team.java

/**
 * Fgt eine neues Teammitglied als {@link Person} dem bestehendem Team hinzu
 * //from w  w w.  j  a  va 2s. c o  m
 * @param person neues Mitglied des Teams als {@link Person}
 * @throws IllegalArgumentException wird geworfen, wenn die Person den Wert <code>null</code>
 *             beinhaltet
 */
public void addMember(Person person) throws IllegalArgumentException {
    if (ObjectUtils.notEqual(null, person)) {
        members.add(person);
    } else {
        throw new IllegalArgumentException("null-person is not allowed!");
    }
}

From source file:cl.troncador.delfin.db.table.Office.java

public boolean equals(Object object) {
    if (object instanceof Office) {
        Office office2 = (Office) object;
        boolean b = ObjectUtils.notEqual(getId(), office2.getId())
                || ObjectUtils.notEqual(getName(), office2.getName())
                || ObjectUtils.notEqual(getAttendantName(), office2.getAttendantName())
                || ObjectUtils.notEqual(getAttendantMail(), office2.getAttendantMail());
        return !b;
    } else {/* w w  w  .j ava 2 s.  c  o  m*/
        return false;
    }
}

From source file:com.norconex.collector.http.crawler.TargetURLRedirectStrategy.java

public static void fixRedirectURL(HttpClient httpClient, HttpDocument doc, HttpCrawlData httpCrawlData,
        ICrawlDataStore database) {/*from   w  ww  .j  av  a 2s  .  com*/
    String originalURL = httpCrawlData.getReference();
    String currentURL = getCurrentUrl();
    if (ObjectUtils.notEqual(currentURL, originalURL)) {
        httpCrawlData.setOriginalReference(originalURL);
        httpCrawlData.setReference(currentURL);
        doc.getMetadata().setString(HttpMetadata.COLLECTOR_URL, currentURL);
        doc.setReference(currentURL);
        //            Unless the DocCrawl is enough to ensure proper storing + sending to committer?
        //                     or... add a setNewURL() instead of storing original URL.
    }
}

From source file:net.pms.configuration.ConfigurationReader.java

private <T> void log(String key, T value, T def) {
    boolean initialised = false;

    if (!logOverrides) {
        return;//from   w  w w .  j  a  va  2 s .  com
    }

    // 1) if a record for this key doesn't exist, initialise it with the default value
    if (!logMap.containsKey(key)) {
        logMap.put(key, def);
        initialised = true;
    }

    // 2) now check if the value has changed
    T oldValue = (T) logMap.get(key);

    if (ObjectUtils.notEqual(oldValue, value)) {
        logMap.put(key, value);

        if (initialised) {
            logger.debug("Reading {}: default: {}, current: {}", key, quote(oldValue), quote(value));
        } else {
            logger.debug("Reading {}: default: {}, previous: {}, current: {}", key, quote(def), quote(oldValue),
                    quote(value));
        }
    }
}

From source file:com.github.jgility.core.project.Team.java

/**
 * Entfernt auf Basis der {@link Person}-Referenz ein Mitglied aus dem {@link Team}
 * /* ww w . j av  a 2 s . c  o m*/
 * @param person zu entfernende {@link Person}
 * @return <code>true</code> wenn {@link Person} in der {@link List} enthalten ist
 */
public boolean removeMember(Person person) {
    if (ObjectUtils.notEqual(null, person)) {
        return members.remove(person);
    }
    return false;
}

From source file:com.github.jgility.core.requirement.ImplementableStory.java

@Override
public void setImplementState(ImplementState implementState) throws IllegalArgumentException {
    if (ObjectUtils.notEqual(null, implementState)) {
        this.implementState = implementState;
    } else {/*from  www. j a  v  a 2 s.  c  om*/
        throw new IllegalArgumentException("implementstate has to be not null!");
    }
}

From source file:com.github.jgility.core.requirement.IterationStory.java

@Override
public void addDependency(IRequirement requirement) throws IllegalArgumentException {
    if (ObjectUtils.notEqual(null, requirement)) {
        dependencies.add(requirement);/*from w  w w .j a va  2  s. c  om*/
    } else {
        throw new IllegalArgumentException("null requirement as dependencie is not allowed!");
    }
}

From source file:com.github.htfv.maven.plugins.buildconfigurator.core.configurators.plugins.AbstractExecutionMergeHelper.java

/**
 * Compares the given target {@link PluginExecution} object with the given
 * source {@link ExecutionConfiguration} object using {@code id}.
 *
 * @param projectExecution/*from   ww w .j  a  v a 2s.c  om*/
 *            target {@link PluginExecution} object.
 * @param execution
 *            source {@link ExecutionConfiguration} object.
 *
 * @return {@code true} if the given target and source objects may be
 *         considered equal.
 */
@Override
public boolean equals(final PluginExecution projectExecution, final ExecutionConfiguration execution) {
    final String id = ctx.getStringValue(execution.getId(), getDefaultId());

    if (ObjectUtils.notEqual(projectExecution.getId(), id)) {
        return false;
    }

    return true;
}