下面列出了怎么用org.apache.commons.lang.builder.EqualsBuilder的API类实例代码及写法,或者点击链接到github查看源代码。
@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));
}
@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();
}
@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();
}
@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();
}
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();
}
/**
* 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();
}
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();
}
}
/** 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);
}
@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();
}
@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();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Ten)) return false;
Ten ten = (Ten) o;
return EqualsBuilder.reflectionEquals(this, ten, new String[]{"nine"});
}
public boolean equals(Object o) {
boolean equal = false;
if (o instanceof RandomException) {
return new EqualsBuilder().append(getMessage(), ((RandomException)o).getMessage()).isEquals();
}
return equal;
}
private BaseMatcher<List<Replacement>> replacementOf(final String xpath, final String value,
final boolean unescape, final String... tokens) {
return new BaseMatcher<List<Replacement>>() {
@SuppressWarnings("unchecked")
public boolean matches(Object arg0) {
List<Replacement> replacements = (List<Replacement>) arg0;
for (int i=0; i < tokens.length; i++) {
Replacement replacement = replacements.get(i);
EqualsBuilder equalsBuilder = new EqualsBuilder();
equalsBuilder.append(tokens[i], replacement.getToken());
equalsBuilder.append(value, replacement.getValue());
equalsBuilder.append(unescape, replacement.isUnescape());
equalsBuilder.append(xpath, replacement.getXpath());
boolean equals = equalsBuilder.isEquals();
if (!equals) {
return false;
}
}
return true;
}
public void describeTo(Description desc) {
desc.appendText("tokens").appendValue(Arrays.asList(tokens));
desc.appendText("value").appendValue(value);
desc.appendText("unescape").appendValue(unescape);
}
};
}
/**
* {@inheritDoc}
*/
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof ScriptResult)) {
return false;
}
ScriptResult r = (ScriptResult) obj;
return new EqualsBuilder().append(this.getActionScriptId(), r.getActionScriptId())
.append(this.getServerId(), r.getServerId())
.append(this.getStartDate(), r.getStartDate())
.append(this.getStopDate(), r.getStopDate())
.append(this.getReturnCode(), r.getReturnCode())
.isEquals();
}
public boolean equals( Object obj ) {
if ( obj instanceof FieldTypeSettings == false ) {
return false;
}
if ( this == obj ) {
return true;
}
FieldTypeSettings rhs = (FieldTypeSettings) obj;
return new EqualsBuilder().append( type, rhs.type ).isEquals();
}
/**
* Override needed for PURAP GL entry creation (hjs) - please do not add "amount" to this method
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof AccountingLine)) {
return false;
}
AccountingLine accountingLine = (AccountingLine) obj;
return new EqualsBuilder().append(this.getChartOfAccountsCode(), accountingLine.getChartOfAccountsCode()).append(this.getAccountNumber(), accountingLine.getAccountNumber()).append(this.getSubAccountNumber(), accountingLine.getSubAccountNumber()).append(this.getFinancialObjectCode(), accountingLine.getFinancialObjectCode()).append(this.getFinancialSubObjectCode(), accountingLine.getFinancialSubObjectCode()).append(this.getProjectCode(), accountingLine.getProjectCode()).append(this.getOrganizationReferenceId(), accountingLine.getOrganizationReferenceId()).append(this.getAmount(), accountingLine.getAmount()).isEquals();
}
/** Two CrNodeVersions are equal if their NvId field is the same */
@Override
public boolean equals(Object other) {
if ((this == other)) {
return true;
}
if (!(other instanceof CrNodeVersion)) {
return false;
}
CrNodeVersion castOther = (CrNodeVersion) other;
return new EqualsBuilder().append(this.getNvId(), castOther.getNvId()).isEquals();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof PartitionKey)) {
return false;
}
PartitionKey key = (PartitionKey) o;
EqualsBuilder builder = new EqualsBuilder();
builder.append(applicationId, key.applicationId);
builder.append(customActionListAttributeNames, key.customActionListAttributeNames);
return builder.isEquals();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Operational) == false) {
return false;
}
Operational rhs = ((Operational) other);
return new EqualsBuilder().append(isStd, rhs.isStd).append(subtheme, rhs.subtheme).append(groupOwn, rhs.groupOwn).append(logicalUri, rhs.logicalUri).append(storageInfo, rhs.storageInfo).append(ingestionPipeline, rhs.ingestionPipeline).append(inputSrc, rhs.inputSrc).append(readType, rhs.readType).append(theme, rhs.theme).append(additionalProperties, rhs.additionalProperties).append(datasetType, rhs.datasetType).append(physicalUri, rhs.physicalUri).isEquals();
}
@Override
public boolean sameValueAs(final RouteSpecification other) {
return other != null && new EqualsBuilder().
append(this.origin, other.origin).
append(this.destination, other.destination).
append(this.arrivalDeadline, other.arrivalDeadline).
isEquals();
}
public boolean equals( Object obj ) {
if ( obj instanceof ConceptPropertyNumber == false ) {
return false;
}
if ( this == obj ) {
return true;
}
ConceptPropertyNumber rhs = (ConceptPropertyNumber) obj;
return new EqualsBuilder().append( value, rhs.value ).isEquals();
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DistributedDataSetPartition)) {
return false;
}
final DistributedDataSetPartition that = (DistributedDataSetPartition) obj;
return new EqualsBuilder().append(this.path, that.path).append(this.location, that.location)
.append(this.desiredSplits, that.desiredSplits).isEquals();
}
/**
* {@inheritDoc}
*/
public boolean equals(Object o) {
if (o == null || !(o instanceof ActionType)) {
return false;
}
ActionType other = (ActionType)o;
return new EqualsBuilder().append(this.getId(), other.getId())
.append(this.getName(), other.getName())
.append(this.getLabel(), other.getLabel())
.append(this.getTriggersnapshot(),
other.getTriggersnapshot())
.append(this.getUnlockedonly(), other.getUnlockedonly())
.isEquals();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof HeaderAllowDenyBean)) {
return false;
}
final HeaderAllowDenyBean rhs = ((HeaderAllowDenyBean) other);
return new EqualsBuilder()
.append(entries, rhs.entries)
.isEquals();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof PartitionKey)) {
return false;
}
PartitionKey key = (PartitionKey) o;
EqualsBuilder builder = new EqualsBuilder();
builder.append(applicationId, key.applicationId);
builder.append(documentSecurityAttributeNames, key.documentSecurityAttributeNames);
return builder.isEquals();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof ExonToTranscriptRelationship) == false) {
return false;
}
ExonToTranscriptRelationship rhs = ((ExonToTranscriptRelationship) other);
return new EqualsBuilder().append(subject, rhs.subject).append(object, rhs.object).isEquals();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Five)) return false;
Five five = (Five) o;
return EqualsBuilder.reflectionEquals(this, five, new String[]{"a", "b", "c"});
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof OrganismTaxon) == false) {
return false;
}
OrganismTaxon rhs = ((OrganismTaxon) other);
return new EqualsBuilder().isEquals();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MergeRequestChangedLabels that = (MergeRequestChangedLabels) o;
return new EqualsBuilder()
.append(previous, that.previous)
.append(current, that.current)
.isEquals();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof NoncodingRNAProduct) == false) {
return false;
}
NoncodingRNAProduct rhs = ((NoncodingRNAProduct) other);
return new EqualsBuilder().isEquals();
}