Skip to content

Commit

Permalink
Merge pull request #449 from eclipse/refactoring
Browse files Browse the repository at this point in the history
Refactoring the current code
  • Loading branch information
otaviojava authored Nov 11, 2023
2 parents d5e3866 + f3a5d99 commit 3fe0364
Show file tree
Hide file tree
Showing 28 changed files with 57 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ColumnDeleteQuery)) {
if (!(o instanceof ColumnDeleteQuery that)) {
return false;
}
ColumnDeleteQuery that = (ColumnDeleteQuery) o;
return Objects.equals(columnFamily, that.name()) &&
Objects.equals(condition, that.condition().orElse(null)) &&
Objects.equals(columns, that.columns());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ColumnQuery)) {
if (!(o instanceof ColumnQuery that)) {
return false;
}
ColumnQuery that = (ColumnQuery) o;
return maxResults == that.limit() &&
firstResult == that.skip() &&
Objects.equals(columnFamily, that.name()) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Value)) {
if (!(o instanceof Value that)) {
return false;
}
Value that = (Value) o;
return Objects.equals(value, that.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void testBind() {
@DisplayName("given a filled Params")
class GivenFilledParamsTest {

class Scenario {
static class Scenario {

final Params params;
final List<String> parameterNameList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DocumentDeleteQuery)) {
if (!(o instanceof DocumentDeleteQuery that)) {
return false;
}
DocumentDeleteQuery that = (DocumentDeleteQuery) o;
return Objects.equals(documentCollection, that.name()) &&
Objects.equals(condition, that.condition().orElse(null)) &&
Objects.equals(documents, that.documents());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DocumentQuery)) {
if (!(o instanceof DocumentQuery that)) {
return false;
}
DocumentQuery that = (DocumentQuery) o;
return limit == that.limit() &&
skip == that.skip() &&
Objects.equals(documentCollection, that.name()) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DocumentEntity)) {
if (!(o instanceof DocumentEntity that)) {
return false;
}
DocumentEntity that = (DocumentEntity) o;
return Objects.equals(this.documents().stream().sorted(comparing(Document::name)).collect(toList()),
that.documents().stream().sorted(comparing(Document::name)).collect(toList())) &&
Objects.equals(name, that.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public String toString() {
'}';
}

public static QueryValue<?> of(QueryParser.BoolContext context) {
public static QueryValue<Boolean> of(QueryParser.BoolContext context) {
String text = context.BOOLEAN().getText();
return new BooleanQueryValue(Boolean.parseBoolean(text));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ConditionQueryValue)) {
if (!(o instanceof ConditionQueryValue that)) {
return false;
}
ConditionQueryValue that = (ConditionQueryValue) o;
return Objects.equals(conditions, that.conditions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultArrayQueryValue)) {
if (!(o instanceof DefaultArrayQueryValue that)) {
return false;
}
DefaultArrayQueryValue that = (DefaultArrayQueryValue) o;
return Arrays.equals(values, that.values);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultFunction)) {
if (!(o instanceof DefaultFunction that)) {
return false;
}
DefaultFunction that = (DefaultFunction) o;
return Objects.equals(name, that.name) &&
Arrays.equals(args, that.args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultQueryValue)) {
if (!(o instanceof DefaultQueryValue that)) {
return false;
}
DefaultQueryValue that = (DefaultQueryValue) o;
return Objects.equals(value, that.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultSelectQuery)) {
if (!(o instanceof DefaultSelectQuery that)) {
return false;
}
DefaultSelectQuery that = (DefaultSelectQuery) o;
return skip == that.skip &&
limit == that.limit &&
Objects.equals(entity, that.entity) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DeleteQuery)) {
if (!(o instanceof DeleteQuery that)) {
return false;
}
DeleteQuery that = (DeleteQuery) o;
return Objects.equals(entity, that.entity) &&
Objects.equals(fields, that.fields) &&
Objects.equals(where, that.where);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof FunctionQueryValue)) {
if (!(o instanceof FunctionQueryValue that)) {
return false;
}
FunctionQueryValue that = (FunctionQueryValue) o;
return Objects.equals(function, that.function);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof GetQuery)) {
if (!(o instanceof GetQuery that)) {
return false;
}
GetQuery that = (GetQuery) o;
return Objects.equals(keys, that.keys);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof InsertQuery)) {
if (!(o instanceof InsertQuery that)) {
return false;
}
InsertQuery that = (InsertQuery) o;
return Objects.equals(entity, that.entity) &&
Objects.equals(duration, that.duration) &&
Objects.equals(conditions, that.conditions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof NumberQueryValue)) {
if (!(o instanceof NumberQueryValue that)) {
return false;
}
NumberQueryValue that = (NumberQueryValue) o;
return Objects.equals(number, that.number);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof StringQueryValue)) {
if (!(o instanceof StringQueryValue that)) {
return false;
}
StringQueryValue that = (StringQueryValue) o;
return Objects.equals(value, that.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UpdateQuery)) {
if (!(o instanceof UpdateQuery that)) {
return false;
}
UpdateQuery that = (UpdateQuery) o;
return Objects.equals(entity, that.entity) &&
Objects.equals(conditions, that.conditions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Where)) {
if (!(o instanceof Where that)) {
return false;
}
Where that = (Where) o;
return Objects.equals(condition, that.condition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof MethodArrayValue)) {
if (!(o instanceof MethodArrayValue that)) {
return false;
}
MethodArrayValue that = (MethodArrayValue) o;
return Arrays.equals(values, that.values);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof MethodParamQueryValue)) {
if (!(o instanceof MethodParamQueryValue that)) {
return false;
}
MethodParamQueryValue that = (MethodParamQueryValue) o;
return Objects.equals(value, that.value);
}

Expand Down
Loading

0 comments on commit 3fe0364

Please sign in to comment.