Example usage for org.apache.commons.lang3.builder EqualsBuilder reflectionEquals

List of usage examples for org.apache.commons.lang3.builder EqualsBuilder reflectionEquals

Introduction

In this page you can find the example usage for org.apache.commons.lang3.builder EqualsBuilder reflectionEquals.

Prototype

public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients) 

Source Link

Document

This method uses reflection to determine if the two Objects are equal.

It uses AccessibleObject.setAccessible to gain access to private fields.

Usage

From source file:nl.knaw.huygens.timbuctoo.model.Change.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof Change)) {
        return false;
    }/*from  w  ww  .  j a v a 2  s. co m*/

    return EqualsBuilder.reflectionEquals(this, obj, false);
}

From source file:org.alfresco.rest.api.tests.BaseCustomModelApiTest.java

protected void compareCustomModels(CustomModel expectedModel, CustomModel actualModel,
        String... excludeFields) {
    boolean result = EqualsBuilder.reflectionEquals(expectedModel, actualModel, excludeFields);
    assertTrue("Two models are not equal. Expected:<" + expectedModel.toString() + "> but was:<"
            + actualModel.toString() + ">", result);
}

From source file:org.alfresco.rest.api.tests.BaseCustomModelApiTest.java

protected void compareCustomTypesAspects(AbstractClassModel expectedDetails, AbstractClassModel actualDetails,
        String... excludeFields) {
    List<CustomModelProperty> expectedProps = expectedDetails.getProperties();
    List<CustomModelProperty> actualProps = actualDetails.getProperties();
    // Sort them/*from   ww w  .java2 s  .co  m*/
    sortIfnotNull(expectedProps);
    sortIfnotNull(actualProps);

    boolean propEqualResult = true;
    if (expectedProps.size() == actualProps.size()) {
        for (int i = 0, size = expectedProps.size(); i < size; i++) {
            boolean equalProp = EqualsBuilder.reflectionEquals(expectedProps.get(i), actualProps.get(i),
                    excludeFields);
            if (!equalProp) {
                propEqualResult = false;
                break;
            }
        }
    } else {
        propEqualResult = false;
    }

    if (excludeFields.length > 0) {
        int size = excludeFields.length;
        excludeFields = Arrays.copyOf(excludeFields, size + 1);
        excludeFields[size] = "properties";
    }
    boolean result = EqualsBuilder.reflectionEquals(expectedDetails, actualDetails, excludeFields);

    String typesAspects = (expectedDetails instanceof CustomAspect) ? "aspects" : "types";
    assertTrue("Two " + typesAspects + " are not equal. Expected:<" + expectedDetails.toString() + "> but was:<"
            + actualDetails.toString() + ">", (result && propEqualResult));
}

From source file:org.alfresco.rest.api.tests.BaseCustomModelApiTest.java

protected void compareCustomModelConstraints(CustomModelConstraint expectedConstraint,
        CustomModelConstraint actualConstraint, String... excludeFields) {
    if (expectedConstraint.getParameters() != null) {
        Collections.sort(expectedConstraint.getParameters());
    }//from   w  w  w  .  j  a v a  2 s  . co m
    if (actualConstraint.getParameters() != null) {
        Collections.sort(actualConstraint.getParameters());
    }

    boolean result = EqualsBuilder.reflectionEquals(expectedConstraint, actualConstraint, excludeFields);
    assertTrue("Two constraints are not equal. Expected:<" + expectedConstraint.toString() + "> but was:<"
            + actualConstraint.toString() + ">", result);
}

From source file:org.alfresco.rest.api.tests.BaseCustomModelApiTest.java

protected void compareCustomModelProperties(CustomModelProperty expectedProperty,
        CustomModelProperty actualProperty, String... excludeFields) {
    boolean result = EqualsBuilder.reflectionEquals(expectedProperty, actualProperty, excludeFields);
    assertTrue("Two constraints are not equal. Expected:<" + expectedProperty.toString() + "> but was:<"
            + actualProperty.toString() + ">", result);
}

From source file:org.apache.nifi.processors.aws.dynamodb.ItemKeys.java

@Override
public boolean equals(Object other) {
    return EqualsBuilder.reflectionEquals(this, other, false);
}

From source file:org.apache.rocketmq.broker.filter.ConsumerFilterData.java

@Override
public boolean equals(Object o) {
    return EqualsBuilder.reflectionEquals(this, o, Collections.<String>emptyList());
}

From source file:org.apache.syncope.core.persistence.beans.AbstractBaseBean.java

@Override
public boolean equals(final Object obj) {
    return EqualsBuilder.reflectionEquals(this, obj, getExcludeFields());
}

From source file:org.apache.syncope.core.provisioning.api.cache.VirAttrCacheKey.java

@Override
public boolean equals(final Object obj) {
    return EqualsBuilder.reflectionEquals(this, obj, true);
}

From source file:org.biokoframework.system.KILL_ME.XSystemIdentityCard.java

@Override
public boolean equals(Object obj) {
    return EqualsBuilder.reflectionEquals(obj, this, false);
}