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:de.thm.arsnova.security.ApplicationPermissionEvaluator.java

private boolean checkQuestionPermission(final String username, final Serializable targetId,
        final Object permission) {
    if (permission instanceof String && permission.equals("owner")) {
        final Question question = dao.getQuestion(targetId.toString());
        if (question != null) {
            final Session session = dao.getSessionFromId(question.getSessionId());
            if (session == null) {
                return false;
            }//w ww  .j  a  v  a  2  s . c  o m
            return session.getCreator().equals(username);
        }
    }
    return false;
}

From source file:org.trustedanalytics.metricsprovider.cloudadapter.api.CfApp.java

private boolean fieldEquals(Object one, Object two) {
    if (one != null) {
        return one.equals(two);
    }//from  ww  w.  j av a2  s  .c o  m
    return two == null;
}

From source file:com.alfaariss.oa.engine.user.provisioning.translator.standard.converter.exist.ExistConverter.java

/**
 * Converts the value to a boolean value.
 * This means: whenever oValue is a String that is non-empty and non-null,
 * a Boolean.TRUE is returned./*from ww  w .j  a v a2s. co m*/
 * This means that when oValue is a Boolean with value false, Boolean.FALSE is returned.
 * @see IConverter#convert(java.lang.Object)
 */
public Object convert(Object oValue) {
    if (oValue == null)
        return Boolean.FALSE;

    if (oValue instanceof Boolean && oValue.equals(Boolean.FALSE))
        return Boolean.FALSE;

    if (!(oValue instanceof String)) {
        _logger.debug("Not a String: " + oValue);
        throw new IllegalArgumentException("Not a String: " + oValue);
    }

    String sValue = (String) oValue;
    if (sValue.length() > 0)
        return Boolean.TRUE;
    return Boolean.FALSE;
}

From source file:com.sonyericsson.hudson.plugins.metadata.model.definitions.StringChoiceMetadataDefinition.java

@Override
public AbstractMetadataValue createValue(Object o) {
    String value = "";
    if (o instanceof String && !o.equals("")) {
        value = (String) o;//from   w w  w  .  j  a  v a  2s  .co m
    } else if (choices.size() > 0) { //if for some reason nothing is chosen, take the first in the list.
        value = choices.get(0);
    }
    StringMetadataValue metadataValue = new StringMetadataValue(getName(), getDescription(), value,
            isExposedToEnvironment());
    return metadataValue;
}

From source file:com.diversityarrays.util.Pair.java

@Override
public boolean equals(Object o) {
    if (o == this)
        return true;
    if (!(o instanceof Pair))
        return false;

    Pair<?, ?> other = (Pair<?, ?>) o;
    Object oa = other.first;
    Object ob = other.second;/*  ww w  .j  a  v  a  2 s  .  c  o m*/

    return (oa == null ? first == null : oa.equals(first)) && (ob == null ? second == null : ob.equals(second));
}

From source file:de.thm.arsnova.security.ApplicationPermissionEvaluator.java

private boolean checkInterposedQuestionPermission(final String username, final Serializable targetId,
        final Object permission) {
    if (permission instanceof String && permission.equals("owner")) {
        final InterposedQuestion question = dao.getInterposedQuestion(targetId.toString());
        if (question != null) {
            // Does the creator want to delete his own question?
            if (question.getCreator() != null && question.getCreator().equals(username)) {
                return true;
            }/*w  w w. j  ava2s  .c o  m*/
            // Allow deletion if requested by session owner
            final Session session = dao.getSessionFromKeyword(question.getSessionId());
            if (session == null) {
                return false;
            }
            return session.getCreator().equals(username);
        }
    }
    return false;
}

From source file:com.clican.pluto.orm.usertype.StringSplitType.java

public boolean equals(Object x, Object y) throws HibernateException {
    if (x == null && y == null) {
        return false;
    }//from   ww w  .  j a v  a2 s.c  o  m
    return x.equals(y);
}

From source file:com.thinkbiganalytics.jpa.TruncateStringUserType.java

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

From source file:ListOfLists.java

public int indexOf(Object o) {
    ListIterator e = listIterator();
    if (o == null) {
        while (e.hasNext()) {
            if (e.next() == null)
                return e.previousIndex();
        }/*from  w  w w .ja va 2  s  . co m*/
    } else {
        Object el;
        while (e.hasNext()) {
            el = e.next();
            if (el.equals(o))
                return e.previousIndex();
        }
    }
    return -1;
}

From source file:net.rrm.ehour.domain.UserRole.java

@Override
public boolean equals(Object obj) {
    boolean isEqual = false;

    if (obj instanceof String) {
        isEqual = obj.equals(this.getRole());
    } else if (obj instanceof UserRole) {
        isEqual = ((UserRole) obj).getRole().equals(this.getRole());
    }/*from ww w.  jav  a 2  s.c om*/

    return isEqual;
}