Search in sources :

Example 41 with EqualsBuilder

use of org.apache.commons.lang.builder.EqualsBuilder in project symmetric-ds by JumpMind.

the class ForeignKey method equals.

/**
 * {@inheritDoc}
 */
public boolean equals(Object obj) {
    if (obj instanceof ForeignKey) {
        ForeignKey otherFk = (ForeignKey) obj;
        // Note that this compares case sensitive
        // Note also that we can simply compare the references regardless of
        // their order
        // (which is irrelevant for fks) because they are contained in a set
        EqualsBuilder builder = new EqualsBuilder();
        if (isCheckName(otherFk)) {
            builder.append(name, otherFk.name);
        }
        builder.append(foreignTableName, otherFk.foreignTableName);
        builder.append(references.size(), otherFk.references.size());
        for (int i = 0; i < references.size() && i < otherFk.references.size(); i++) {
            builder.append(references.get(i), otherFk.references.get(i));
        }
        return builder.isEquals();
    } else {
        return false;
    }
}
Also used : EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder)

Example 42 with EqualsBuilder

use of org.apache.commons.lang.builder.EqualsBuilder in project commons by twitter.

the class ZooKeeperClient method credentials.

/**
 * Creates a set of credentials for the given authentication {@code scheme}.
 *
 * @param scheme the scheme to authenticate with
 * @param authToken the authentication token
 * @return a set of credentials that can be used to authenticate the zoo keeper client
 */
public static Credentials credentials(final String scheme, final byte[] authToken) {
    MorePreconditions.checkNotBlank(scheme);
    Preconditions.checkNotNull(authToken);
    return new Credentials() {

        @Override
        public void authenticate(ZooKeeper zooKeeper) {
            zooKeeper.addAuthInfo(scheme, authToken);
        }

        @Override
        public String scheme() {
            return scheme;
        }

        @Override
        public byte[] authToken() {
            return authToken;
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Credentials)) {
                return false;
            }
            Credentials other = (Credentials) o;
            return new EqualsBuilder().append(scheme, other.scheme()).append(authToken, other.authToken()).isEquals();
        }

        @Override
        public int hashCode() {
            return Objects.hashCode(scheme, authToken);
        }
    };
}
Also used : ZooKeeper(org.apache.zookeeper.ZooKeeper) EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder)

Example 43 with EqualsBuilder

use of org.apache.commons.lang.builder.EqualsBuilder in project rest.li by linkedin.

the class BatchingKey method equals.

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || !(o instanceof BatchingKey))
        return false;
    @SuppressWarnings("unchecked") BatchingKey<T, R> that = (BatchingKey<T, R>) o;
    EqualsBuilder builder = new EqualsBuilder();
    builder.append(_request.getBaseUriTemplate(), that._request.getBaseUriTemplate());
    builder.append(_request.getPathKeys(), that._request.getPathKeys());
    builder.append(_request.getResourceProperties(), that._request.getResourceProperties());
    builder.append(_request.getRequestOptions(), that._request.getRequestOptions());
    builder.append(_queryParams, that._queryParams);
    builder.append(_batchFields, that._batchFields);
    if (_batchFields)
        builder.append(_request.getFields(), that._request.getFields());
    return builder.isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder)

Example 44 with EqualsBuilder

use of org.apache.commons.lang.builder.EqualsBuilder in project gora by apache.

the class QueryWSBase method equals.

@SuppressWarnings({ "rawtypes" })
@Override
public /**
 * Determines if this object is equal to a different one
 */
boolean equals(Object obj) {
    if (obj instanceof QueryWSBase) {
        QueryWSBase that = (QueryWSBase) obj;
        EqualsBuilder builder = new EqualsBuilder();
        builder.append(dataStore, that.dataStore);
        builder.append(queryString, that.queryString);
        builder.append(fields, that.fields);
        builder.append(startKey, that.startKey);
        builder.append(endKey, that.endKey);
        builder.append(filter, that.filter);
        builder.append(limit, that.limit);
        return builder.isEquals();
    }
    return false;
}
Also used : EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder)

Example 45 with EqualsBuilder

use of org.apache.commons.lang.builder.EqualsBuilder in project pentaho-platform by pentaho.

the class PentahoUser method equals.

public boolean equals(Object obj) {
    if (obj instanceof PentahoUser == false) {
        return false;
    }
    if (this == obj) {
        return true;
    }
    PentahoUser rhs = (PentahoUser) obj;
    boolean result;
    if ((getTenant() == null) && (rhs.getTenant() == null)) {
        result = new EqualsBuilder().append(username, rhs.username).isEquals();
    } else {
        result = new EqualsBuilder().append(username, rhs.username).append(tenant, rhs.tenant).isEquals();
    }
    return result;
}
Also used : IPentahoUser(org.pentaho.platform.api.engine.security.userroledao.IPentahoUser) EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder)

Aggregations

EqualsBuilder (org.apache.commons.lang.builder.EqualsBuilder)95 ZooKeeper (org.apache.zookeeper.ZooKeeper)1 Product (org.candlepin.model.Product)1 AbstractStepMeta (org.pentaho.di.core.util.AbstractStepMeta)1 IPentahoRole (org.pentaho.platform.api.engine.security.userroledao.IPentahoRole)1 IPentahoUser (org.pentaho.platform.api.engine.security.userroledao.IPentahoUser)1