Example usage for java.lang Object equals

List of usage examples for java.lang Object equals

Introduction

In this page you can find the example usage for java.lang Object equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:airbrake.AirbrakeNotifierTest.java

private <T> Matcher<T> internalServerError() {
    return new BaseMatcher<T>() {
        public void describeTo(final Description description) {
            description.appendText("internal server error");
        }//from  w ww  . j av a2  s .com

        public boolean matches(final Object item) {
            return item.equals(500);
        }
    };
}

From source file:com.orange.mmp.api.ws.jsonrpc.SimpleJSONSerializer.java

@Override
public Object marshall(SerializerState state, Object parent, Object java, Object ref) throws MarshallException {
    if (java == null || java.equals(null)) {
        return JSONObject.NULL;
    } else//from ww  w .  jav  a2  s  . c  o  m
        return super.marshall(state, parent, java, ref);
}

From source file:com.vsct.dt.hesperides.util.ManageableConnectionPoolMock.java

public void checkSavedLastEventOnStream(String streamName, Object event)
        throws IOException, ClassNotFoundException {
    final String lastEvent = this.poolMock.getResource().getLastEvent(streamName);

    assertFalse("Event stored in wrong event stream", lastEvent == null);

    Event eventStored = MAPPER.readValue(lastEvent, Event.class);

    Object hesperidesEvent = MAPPER.readValue(eventStored.getData(), Class.forName(eventStored.getEventType()));

    assertTrue("Wrong event stored", hesperidesEvent.equals(event));
}

From source file:org.jpos.ee.usertype.JsonType.java

@Override
public boolean equals(Object x, Object y) throws HibernateException {
    return (x == y) || ((x != null) && (y != null) && (x.equals(y)));
}

From source file:io.dyn.el.SpelExpression.java

@Override
public int compareTo(Object obj) {
    // Check for object equality
    if (null != obj && (obj == this || obj.equals(this))) {
        return 0;
    }//w w  w.  j av  a 2  s . c  o m
    // If that fails, try and check the expressions
    try {
        Object o1 = expression.getValue(evaluationContext);
        Object o2 = null;
        try {
            if (obj instanceof String) {
                o2 = toExpression((String) obj).getValue(evaluationContext);
            } else if (obj instanceof SpelExpression) {
                o2 = ((SpelExpression) o2).expression.getValue(evaluationContext);
            } else if (obj instanceof Expression) {
                o2 = ((Expression) obj).getValue(evaluationContext);
            }
        } catch (NullPointerException npe) {
            return -1;
        }
        if (null != o1) {
            if (o1.equals(o2)) {
                return 0;
            }
        }
    } catch (SpelEvaluationException ignored) {
    }

    return -1;
}

From source file:jaspex.transactifier.ChangeArrayAccessMethodVisitor.java

private Type typeFromRelPos(int pos) {
    Object type = _analyzerAdapter.stack.get(_analyzerAdapter.stack.size() + pos);
    if (type.equals(Opcodes.NULL)) {
        // Operao ser feita sobre um null (== NPE)
        return Type.PRIM_BYTE;
    }//from www . j a  v  a 2  s.  c om
    return Type.fromBytecode((String) type);
}

From source file:com.microsoft.campaignmanager.viewmodel.CampaignListViewItem.java

/**
 * Safe string./*  w  w w . j a  va2  s.  c  om*/
 *
 * @param object the object
 * @return the string
 */
private String safeString(Object object) {
    if (object == null)
        return "";
    if (object.equals(JSONObject.NULL)) {
        return "";
    }
    return object.toString().trim();
}

From source file:br.org.acessobrasil.silvinha.vista.panels.PainelSenha.java

private void getPassword() {
    JDialog dialog = op.createDialog(this, GERAL.SENHA_SOLICITADA_SERVIDOR);
    dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    dialog.setVisible(true);//from w ww . j  a  v a  2 s  . c  o m
    Object opcao = op.getValue();
    if (opcao != null) {
        if (opcao.equals(JOptionPane.OK_OPTION)) {
            this.user = txtName.getText();
            this.password = String.valueOf(txtPass.getPassword());
        } else if (opcao.equals(JOptionPane.CANCEL_OPTION)) {
            this.cancelAuth = true;
        }
    }
}

From source file:com.enonic.cms.core.content.contentdata.custom.relationdataentrylistbased.AbstractRelationDataEntryListBasedInputDataEntry.java

private boolean equalsEntries(List entriesA, List entriesB) {
    if (entriesA.size() != entriesB.size()) {
        return false;
    }/* www .j av a 2s . c  om*/

    for (int i = 0; i < entriesA.size(); i++) {
        final Object entryA = entriesA.get(i);
        final Object entryB = entriesB.get(i);
        if (!entryA.equals(entryB)) {
            return false;
        }
    }

    return true;
}

From source file:org.spring.data.gemfire.app.beans.Address.java

protected boolean equalsIgnoreNull(final Object obj1, final Object obj2) {
    return (obj1 == null ? obj2 == null : obj1.equals(obj2));
}