Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienvermeille committed Aug 23, 2024
1 parent 51159d3 commit 90bf8ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,16 @@ public abstract class BaseCaseStyle implements CaseStyle {

@Override
public boolean equals(@Nullable Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof CaseStyle caseStyle) {
return equals(caseStyle);
} else {
return false;
}
}

/**
* Determines equality based on the {@link #getName()} method.
*
* @param otherCaseStyle the object to compare with
* @return true if the given object is a {@code CaseStyle} with the same name, false otherwise
*/
public boolean equals(@Nullable final CaseStyle otherCaseStyle) {
if (this == otherCaseStyle) {
if (this == obj) {
return true;
}
if (otherCaseStyle == null || getClass() != otherCaseStyle.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return getName().equals(otherCaseStyle.getName());

CaseStyle caseStyle = (CaseStyle) obj;
return getName().equals(caseStyle.getName());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,11 @@ default Set<String> getVariantNames() {
return unmodifiableSet(of(getName()));
}

boolean equals(@Nullable Object otherCaseStyle);
/**
* Determines equality based on the {@link #getName()} method.
*
* @param object the object to compare with
* @return true if the given object is a {@code CaseStyle} with the same name, false otherwise
*/
boolean equals(@Nullable Object object);
}

0 comments on commit 90bf8ae

Please sign in to comment.