org.apache.commons.lang.builder.EqualsBuilder Java Examples

The following examples show how to use org.apache.commons.lang.builder.EqualsBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Foo.java    From cougar with Apache License 2.0 6 votes vote down vote up
public boolean equals(Object o) {
    if (!(o instanceof Foo)) {
        return false;
    }

    if (this == o) {
        return true;
    }
    Foo another = (Foo)o;

    return new EqualsBuilder()
        .append(fooName, another.fooName)
        .append(bar, another.bar)
        .append(barBazMap, another.barBazMap)
        .append(primitiveArray, another.primitiveArray)
        .isEquals();
}
 
Example #2
Source File: ShortcutCreationDTO.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }

    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    ShortcutCreationDTO that = (ShortcutCreationDTO) o;

    return new EqualsBuilder()
            .append(name, that.name)
            .append(category, that.category)
            .append(description, that.description)
            .append(icon, that.icon)
            .append(miniature, that.miniature)
            .append(executable, that.executable)
            .isEquals();
}
 
Example #3
Source File: EngineDTO.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }

    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    EngineDTO engineDTO = (EngineDTO) o;

    return new EqualsBuilder()
            .append(category, engineDTO.category)
            .append(subCategory, engineDTO.subCategory)
            .append(version, engineDTO.version)
            .append(userData, engineDTO.userData)
            .isEquals();
}
 
Example #4
Source File: TeeRepository.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }

    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    TeeRepository that = (TeeRepository) o;

    return new EqualsBuilder()
            .append(leftRepository, that.leftRepository)
            .append(rightRepository, that.rightRepository)
            .isEquals();
}
 
Example #5
Source File: TherapeuticLink.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean equals(Object obj) {
   if (obj == null) {
      return false;
   } else if (!(obj instanceof TherapeuticLink)) {
      return false;
   } else if (obj == this) {
      return true;
   } else {
      TherapeuticLink other = (TherapeuticLink)obj;
      EqualsBuilder builder = new EqualsBuilder();
      builder.append(this.comment, other.comment);
      builder.append(this.endDate, other.endDate);
      builder.append(this.hcParty, other.hcParty);
      builder.append(this.patient, other.patient);
      builder.append(this.startDate, other.startDate);
      builder.append(this.status, other.status);
      return builder.isEquals();
   }
}
 
Example #6
Source File: ECSTaskTemplateTest.java    From amazon-ecs-plugin with MIT License 6 votes vote down vote up
@Test
public void shouldMerge() throws Exception {

    ECSTaskTemplate parent = getParent();
    ECSTaskTemplate child = getChild("parent");

    ECSTaskTemplate expected = new ECSTaskTemplate(
        "child-name", "child-label",
        null, null, "child-image", "child-repository-credentials", "EC2", "child-network-mode", "child-remoteFSRoot",
        false, null, 0, 0, 0, null, null, false, false,
        "child-containerUser", null, null, null, null, null, null, null, null, null, 0);


    ECSTaskTemplate result = child.merge(parent);
    assertTrue(EqualsBuilder.reflectionEquals(expected, result));
}
 
Example #7
Source File: DateTimesTest.java    From googleads-java-lib with Apache License 2.0 6 votes vote down vote up
/** Asserts that two API date times are equal. */
private static void assertEquals(
    com.google.api.ads.admanager.jaxws.v201911.DateTime expected,
    com.google.api.ads.admanager.jaxws.v201911.DateTime actual) {
  boolean equals =
      expected == actual
          || new EqualsBuilder()
              .append(expected.getDate().getYear(), actual.getDate().getYear())
              .append(expected.getDate().getMonth(), actual.getDate().getMonth())
              .append(expected.getDate().getDay(), actual.getDate().getDay())
              .append(expected.getHour(), actual.getHour())
              .append(expected.getMinute(), actual.getMinute())
              .append(expected.getSecond(), actual.getSecond())
              .append(
                  DateTimeZone.forTimeZone(TimeZone.getTimeZone(expected.getTimeZoneId()))
                      .toTimeZone()
                      .getRawOffset(),
                  DateTimeZone.forTimeZone(TimeZone.getTimeZone(actual.getTimeZoneId()))
                      .toTimeZone()
                      .getRawOffset())
              .isEquals();
  Assert.assertTrue(
      String.format("Expected: <%s> Actual: <%s>", toString(expected), toString(actual)), equals);
}
 
Example #8
Source File: Mutant.java    From CodeDefenders with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) return true;

    if (o == null || getClass() != o.getClass()) return false;

    Mutant mutant = (Mutant) o;

    return new EqualsBuilder()
            .append(id, mutant.id)
            .append(gameId, mutant.gameId)
            .append(playerId, mutant.playerId)
            .append(javaFile, mutant.javaFile)
            .append(md5, mutant.md5)
            .append(classFile, mutant.classFile)
            .isEquals();
}
 
Example #9
Source File: PurapAccountRevisionGroup.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Overridden so that group by statement can be easily implemented.
 * <li>DO NOT REMOVE this method, it is critical to reconciliation process</li>
 * 
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null || !PurapAccountRevisionGroup.class.isAssignableFrom(obj.getClass())) {
        return false;
    }
    PurapAccountRevisionGroup test = (PurapAccountRevisionGroup) obj;
    EqualsBuilder equalsBuilder = new EqualsBuilder();
    equalsBuilder.append(this.postingYear, test.getPostingYear());
    equalsBuilder.append(itemIdentifier, test.getItemIdentifier());
    equalsBuilder.append(replaceFiller(chartOfAccountsCode), replaceFiller(test.getChartOfAccountsCode()));
    equalsBuilder.append(replaceFiller(accountNumber), replaceFiller(test.getAccountNumber()));
    equalsBuilder.append(replaceFiller(subAccountNumber), replaceFiller(test.getSubAccountNumber()));
    equalsBuilder.append(replaceFiller(financialObjectCode), replaceFiller(test.getFinancialObjectCode()));
    equalsBuilder.append(replaceFiller(financialSubObjectCode), replaceFiller(test.getFinancialSubObjectCode()));
    equalsBuilder.append(replaceFiller(postingPeriodCode), replaceFiller(test.getPostingPeriodCode()));
    equalsBuilder.append(replaceFiller(projectCode), replaceFiller(test.getProjectCode()));
    equalsBuilder.append(replaceFiller(organizationReferenceId), replaceFiller(test.getOrganizationReferenceId()));
    return equalsBuilder.isEquals();
}
 
Example #10
Source File: SecurityRule.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof SecurityRule)) {
        return false;
    }
    final SecurityRule another = (SecurityRule) obj;
    return new EqualsBuilder()
            .append(ethertype, another.ethertype)
            .append(ipPrefix, another.ipPrefix)
            .append(portRangeMin, another.portRangeMin)
            .append(portRangeMax, another.portRangeMax)
            .append(profileUuid, another.profileUuid)
            .append(protocol, another.protocol)
            .isEquals();
}
 
Example #11
Source File: GenomicEntity.java    From biolink-model with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other == this) {
        return true;
    }
    if ((other instanceof GenomicEntity) == false) {
        return false;
    }
    GenomicEntity rhs = ((GenomicEntity) other);
    return new EqualsBuilder().append(hasBiologicalSequence, rhs.hasBiologicalSequence).isEquals();
}
 
Example #12
Source File: Publication.java    From biolink-model with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other == this) {
        return true;
    }
    if ((other instanceof Publication) == false) {
        return false;
    }
    Publication rhs = ((Publication) other);
    return new EqualsBuilder().isEquals();
}
 
Example #13
Source File: ContentSecurityPolicyBean.java    From apiman-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other == this) {
        return true;
    }
    if ((other instanceof ContentSecurityPolicyBean) == false) {
        return false;
    }
    ContentSecurityPolicyBean rhs = ((ContentSecurityPolicyBean) other);
    return new EqualsBuilder().append(mode, rhs.mode).append(csp, rhs.csp)
            .append(additionalProperties, rhs.additionalProperties).isEquals();
}
 
Example #14
Source File: TextFileInputMetaLoadSaveTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override public boolean validateTestObject( TextFileFilter testObject, Object actual ) {
  if ( !( actual instanceof TextFileFilter ) ) {
    return false;
  }

  TextFileFilter another = (TextFileFilter) actual;
  return new EqualsBuilder()
    .append( testObject.getFilterPosition(), another.getFilterPosition() )
    .append( testObject.getFilterString(), another.getFilterString() )
    .append( testObject.isFilterLastLine(), another.isFilterLastLine() )
    .append( testObject.isFilterPositive(), another.isFilterPositive() )
    .isEquals();
}
 
Example #15
Source File: Pair.java    From staash with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other ==  this) return true;
    if (!(other instanceof Pair))
        return false;
    Pair<?,?> that = (Pair<?,?>) other;
    return new EqualsBuilder().
               append(this.left, that.left).
               append(this.right, that.left).
               isEquals();
}
 
Example #16
Source File: TaggedMetric.java    From timely with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof TaggedMetric)) {
        return false;
    }
    TaggedMetric o = (TaggedMetric) obj;
    EqualsBuilder eb = new EqualsBuilder();
    eb.append(this.columnVisibility.toString(), o.columnVisibility.toString());
    eb.append(this.orderedTags, o.orderedTags);
    return eb.isEquals();
}
 
Example #17
Source File: NameParser.java    From docker-java with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (obj instanceof ReposTag) {
        ReposTag other = (ReposTag) obj;
        return new EqualsBuilder().append(repos, other.repos).append(tag, other.tag).isEquals();
    } else {
        return false;
    }
}
 
Example #18
Source File: Pair.java    From staash with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other ==  this) return true;
    if (!(other instanceof Pair))
        return false;
    Pair<?,?> that = (Pair<?,?>) other;
    return new EqualsBuilder().
               append(this.left, that.left).
               append(this.right, that.left).
               isEquals();
}
 
Example #19
Source File: DataLogStatusChangeDTO.java    From agile-service-old with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (!(o instanceof DataLogStatusChangeDTO)) {
        return false;
    }
    DataLogStatusChangeDTO that = (DataLogStatusChangeDTO) o;
    return new EqualsBuilder()
            .append(getLogId(), that.getLogId())
            .append(getNewValue(), that.getNewValue())
            .isEquals();
}
 
Example #20
Source File: SelectorBuilderImpl.java    From googleads-java-lib with Apache License 2.0 5 votes vote down vote up
/**
 * The {@code equals} method only considers the {@code field} and the {@code sortOrder}
 * attributes.
 */
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof OrderBy)) {
    return false;
  }
  OrderBy other = (OrderBy) obj;
  return new EqualsBuilder().append(getField(), other.getField())
      .append(getSortOrder(), other.getSortOrder()).isEquals();
}
 
Example #21
Source File: ChannelArch.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean equals(final Object other) {
    if (!(other instanceof ChannelArch)) {
        return false;
    }

    ChannelArch castOther = (ChannelArch) other;
    return new EqualsBuilder().append(this.getId(), castOther.getId()).isEquals();
}
 
Example #22
Source File: ExternalAuthenticationProvider.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private boolean isEquals(User user1, User user2) {
	EqualsBuilder equalsBuilder = new EqualsBuilder();
	equalsBuilder.append(user1.getRealName(), user2.getRealName());
	equalsBuilder.append(user1.getPassword(), user2.getPassword());
	equalsBuilder.append(user1.getEmail(), user2.getEmail());
	equalsBuilder.append(user1.isAdmin(), user2.isAdmin());
	equalsBuilder.append(user1.isEnabled(), user2.isEnabled());
	equalsBuilder.append(user1.getProfile(), user2.getProfile());
	
	return equalsBuilder.isEquals();
}
 
Example #23
Source File: MacromolecularMachineToMolecularActivityAssociation.java    From biolink-model with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other == this) {
        return true;
    }
    if ((other instanceof MacromolecularMachineToMolecularActivityAssociation) == false) {
        return false;
    }
    MacromolecularMachineToMolecularActivityAssociation rhs = ((MacromolecularMachineToMolecularActivityAssociation) other);
    return new EqualsBuilder().append(object, rhs.object).isEquals();
}
 
Example #24
Source File: Daco.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
   public boolean equals(Object o) {
if (this == o) {
    return true;
}
if (!(o instanceof Daco)) {
    return false;
}

final Daco genericEntity = (Daco) o;

return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title)
	.append(instructions, genericEntity.instructions).append(created, genericEntity.created)
	.append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals();
   }
 
Example #25
Source File: PathognomonicityQuantifier.java    From biolink-model with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    if (other == this) {
        return true;
    }
    if ((other instanceof PathognomonicityQuantifier) == false) {
        return false;
    }
    PathognomonicityQuantifier rhs = ((PathognomonicityQuantifier) other);
    return new EqualsBuilder().isEquals();
}
 
Example #26
Source File: CustomDataValue.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean equals(final Object other) {
    if (other == null || !(other instanceof ServerAction)) {
        return false;
    }
    CustomDataValue castOther = (CustomDataValue) other;
    return new EqualsBuilder().append(key, castOther.getKey())
                              .append(server, castOther.getServer()).isEquals();
}
 
Example #27
Source File: SubmitFilesSession.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
   public boolean equals(Object other) {
if ((this == other)) {
    return true;
}
if (!(other instanceof SubmitFilesSession)) {
    return false;
}
SubmitFilesSession castOther = (SubmitFilesSession) other;
return new EqualsBuilder().append(this.getSessionID(), castOther.getSessionID())
	.append(this.getStatus(), castOther.getStatus()).isEquals();
   }
 
Example #28
Source File: AppConfig.java    From HeadsUp with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compares given {@link com.achep.acdisplay.blacklist.AppConfig} with
 * this one. <b>Warning: </b> the only criterion of equality is the package name!
 */
@Override
public boolean equals(Object o) {
    if (o == this)
        return true;
    if (!(o instanceof AppConfig))
        return false;

    AppConfig ps = (AppConfig) o;
    return new EqualsBuilder()
            .append(packageName, ps.packageName)
            .isEquals();
}
 
Example #29
Source File: HandlingActivity.java    From dddsample-core with MIT License 5 votes vote down vote up
@Override
public boolean sameValueAs(final HandlingActivity other) {
  return other != null && new EqualsBuilder().
    append(this.type, other.type).
    append(this.location, other.location).
    append(this.voyage, other.voyage).
    isEquals();
}
 
Example #30
Source File: IsReserializable.java    From concurrentlinkedhashmap with Apache License 2.0 5 votes vote down vote up
@Override
public boolean matchesSafely(T item) {
  T copy = reserialize(item);

  EqualsBuilder builder = new EqualsBuilder()
      .append(item.hashCode(), copy.hashCode())
      .append(item, copy)
      .append(copy, item);
  if (item instanceof ConcurrentLinkedHashMap<?, ?>) {
    return matchesSafely((ConcurrentLinkedHashMap<?, ?>) item,
        (ConcurrentLinkedHashMap<?, ?>) copy, builder);
  }
  return builder.isEquals();
}