8000 implemented equals and hashCode for all entity classes · arangodb/arangodb-java-driver@b27ef40 · GitHub
[go: up one dir, main page]

Skip to content
Sign in

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b27ef40

Browse files
committed
implemented equals and hashCode for all entity classes
1 parent 5624bcb commit b27ef40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+771
-3
lines changed

ChangeLog.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1111
- allow construct ArangoConfigProperties from `java.util.Properties` (DE-976)
1212
- made BaseDocument and BaseEdgeDocument serializable (#596)
1313

14-
1514
## [7.16.0] - 2025-01-09
1615

1716
- improved deserialization of `RawBytes` and `RawJson` (#592, DE-969)

core/src/main/java/com/arangodb/entity/AqlExecutionExplainEntity.java

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import java.util.Collection;
2727
import java.util.Map;
28+
import java.util.Objects;
2829

2930
/**
3031
* @author Mark Vollmary
@@ -59,6 +60,18 @@ public Boolean getCacheable() {
5960
return cacheable;
6061
}
6162

63+
@Override
64+
public boolean equals(Object o) {
65+
if (!(o instanceof AqlExecutionExplainEntity)) return false;
66+
AqlExecutionExplainEntity that = (AqlExecutionExplainEntity) o;
67+
return Objects.equals(plan, that.plan) && Objects.equals(plans, that.plans) && Objects.equals(warnings, that.warnings) && Objects.equals(stats, that.stats) && Objects.equals(cacheable, that.cacheable);
68+
}
69+
70+
@Override
71+
public int hashCode() {
72+
return Objects.hash(plan, plans, warnings, stats, cacheable);
73+
}
74+
6275
public static final class ExecutionPlan {
6376
private Collection<ExecutionNode> nodes;
6477
private Collection<String> rules;
@@ -90,6 +103,18 @@ public Integer getEstimatedCost() {
90103
public Integer getEstimatedNrItems() {
91104
return estimatedNrItems;
92105
}
106+
107+
@Override
108+
public boolean equals(Object o) {
109+
if (!(o instanceof ExecutionPlan)) return false;
110+
ExecutionPlan that = (ExecutionPlan) o;
111+
return Objects.equals(nodes, that.nodes) && Objects.equals(rules, that.rules) && Objects.equals(collections, that.collections) && Objects.equals(variables, that.variables) && Objects.equals(estimatedCost, that.estimatedCost) && Objects.equals(estimatedNrItems, that.estimatedNrItems);
112+
}
113+
114+
@Override
115+
public int hashCode() {
116+
return Objects.hash(nodes, rules, collections, variables, estimatedCost, estimatedNrItems);
117+
}
93118
}
94119

95120
public static final class ExecutionNode {
@@ -208,6 +233,18 @@ public ExecutionCollection getCondition() {
208233
public Boolean getReverse() {
209234
return reverse;
210235
}
236+
237+
@Override
238+
public boolean equals(Object o) {
239+
if (!(o instanceof ExecutionNode)) return false;
240+
ExecutionNode that = (ExecutionNode) o;
241+
return Objects.equals(type, that.type) && Objects.equals(dependencies, that.dependencies) && Objects.equals(id, that.id) && Objects.equals(estimatedCost, that.estimatedCost) && Objects.equals(estimatedNrItems, that.estimatedNrItems) && Objects.equals(depth, that.depth) && Objects.equals(database, that.database) && Objects.equals(collection, that.collection) && Objects.equals(inVariable, that.inVariable) && Objects.equals(outVariable, that.outVariable) && Objects.equals(conditionVariable, that.conditionVariable) && Objects.equals(random, that.random) && Objects.equals(offset, that.offset) && Objects.equals(limit, that.limit) && Objects.equals(fullCount, that.fullCount) && Objects.equals(subquery, that.subquery) && Objects.equals(isConst, that.isConst) && Objects.equals(canThrow, that.canThrow) && Objects.equals(expressionType, that.expressionType) && Objects.equals(indexes, that.indexes) && Objects.equals(expression, that.expression) && Objects.equals(condition, that.condition) && Objects.equals(reverse, that.reverse);
242+
}
243+
244+
@Override
245+
public int hashCode() {
246+
return Objects.hash(type, dependencies, id, estimatedCost, estimatedNrItems, depth, database, collection, inVariable, outVariable, conditionVariable, random, offset, limit, fullCount, subquery, isConst, canThrow, expressionType, indexes, expression, condition, reverse);
247+
}
211248
}
212249

213250
public static final class ExecutionVariable {
@@ -221,6 +258,18 @@ public Long getId() {
221258
public String getName() {
222259
return name;
223260
}
261+
262+
@Override
263+
public boolean equals(Object o) {
264+
if (!(o instanceof ExecutionVariable)) return false;
265+
ExecutionVariable that = (ExecutionVariable) o;
266+
return Objects.equals(id, that.id) && Objects.equals(name, that.name);
267+
}
268+
269+
@Override
270+
public int hashCode() {
271+
return Objects.hash(id, name);
272+
}
224273
}
225274

226275
public static final class ExecutionExpression {
@@ -264,6 +313,18 @@ public Collection<Long> getLevels() {
264313
public Collection<ExecutionExpression> getSubNodes() {
265314
return subNodes;
266315
}
316+
317+
@Override
318+
public boolean equals(Object o) {
319+
if (!(o instanceof ExecutionExpression)) return false;
320+
ExecutionExpression that = (ExecutionExpression) o;
321+
return Objects.equals(type, that.type) && Objects.equals(name, that.name) && Objects.equals(id, that.id) && Objects.equals(value, that.value) && Objects.equals(sorted, that.sorted) && Objects.equals(quantifier, that.quantifier) && Objects.equals(levels, that.levels) && Objects.equals(subNodes, that.subNodes);
322+
}
323+
324+
@Override
325+
public int hashCode() {
326+
return Objects.hash(type, name, id, value, sorted, quantifier, levels, subNodes);
327+
}
267328
}
268329

269330
public static final class ExecutionCollection {
@@ -277,6 +338,18 @@ public String getName() {
277338
public String getType() {
278339
return type;
279340
}
341+
342+
@Override
343+
public boolean equals(Object o) {
344+
if (!(o instanceof ExecutionCollection)) return false;
345+
ExecutionCollection that = (ExecutionCollection) o;
346+
return Objects.equals(name, that.name) && Objects.equals(type, that.type);
347+
}
348+
349+
@Override
350+
public int hashCode() {
351+
return Objects.hash(name, type);
352+
}
280353
}
281354

282355
public static final class ExecutionStats {
@@ -305,6 +378,18 @@ public Long getPeakMemoryUsage() {
305378
public Double getExecutionTime() {
306379
return executionTime;
307380
}
381+
382+
@Override
383+
public boolean equals(Object o) {
384+
if (!(o instanceof ExecutionStats)) return false;
385+
ExecutionStats that = (ExecutionStats) o;
386+
return Objects.equals(rulesExecuted, that.rulesExecuted) && Objects.equals(rulesSkipped, that.rulesSkipped) && Objects.equals(plansCreated, that.plansCreated) && Objects.equals(peakMemoryUsage, that.peakMemoryUsage) && Objects.equals(executionTime, that.executionTime);
387+
}
388+
389+
@Override
390+
public int hashCode() {
391+
return Objects.hash(rulesExecuted, rulesSkipped, plansCreated, peakMemoryUsage, executionTime);
392+
}
308393
}
309394

310395
}

core/src/main/java/com/arangodb/entity/AqlFunctionEntity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.arangodb.entity;
2222

23+
import java.util.Objects;
24+
2325
/**
2426
* @author Mark Vollmary
2527
*/
@@ -56,4 +58,15 @@ public Boolean getIsDeterministic() {
5658
return isDeterministic;
5759
}
5860

61+
@Override
62+
public boolean equals(Object o) {
63+
if (!(o instanceof AqlFunctionEntity)) return false;
64+
AqlFunctionEntity that = (AqlFunctionEntity) o;
65+
return Objects.equals(name, that.name) && Objects.equals(code, that.code) && Objects.equals(isDeterministic, that.isDeterministic);
66+
}
67+
68+
@Override
69+
public int hashCode() {
70+
return Objects.hash(name, code, isDeterministic);
71+
}
5972
}

core/src/main/java/com/arangodb/entity/AqlParseEntity.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package com.arangodb.entity;
2222

2323
import java.util.Collection;
24+
import java.util.Objects;
2425

2526
/**
2627
* @author Mark Vollmary
@@ -43,6 +44,18 @@ public Collection<AstNode> getAst() {
4344
return ast;
4445
}
4546

47+
@Override
48+
public boolean equals(Object o) {
49+
if (!(o instanceof AqlParseEntity)) return false;
50+
AqlParseEntity that = (AqlParseEntity) o;
51+
return Objects.equals(collections, that.collections) && Objects.equals(bindVars, that.bindVars) && Objects.equals(ast, that.ast);
52+
}
53+
54+
@Override
55+
public int hashCode() {
56+
return Objects.hash(collections, bindVars, ast);
57+
}
58+
4659
public static final class AstNode {
4760
private String type;
4861
private Collection<AstNode> subNodes;
@@ -70,6 +83,17 @@ public Object getValue() {
7083
return value;
7184
}
7285

86+
@Override
87+
public boolean equals(Object o) {
88+
if (!(o instanceof AstNode)) return false;
89+
AstNode astNode = (AstNode) o;
90+
return Objects.equals(type, astNode.type) && Objects.equals(subNodes, astNode.subNodes) && Objects.equals(name, astNode.name) && Objects.equals(id, astNode.id) && Objects.equals(value, astNode.value);
91+
}
92+
93+
@Override
94+
public int hashCode() {
95+
return Objects.hash(type, subNodes, name, id, value);
96+
}
7397
}
7498

7599
}

core/src/main/java/com/arangodb/entity/AqlQueryExplainEntity.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.Collection;
2626
import java.util.HashMap;
2727
import java.util.Map;
28+
import java.util.Objects;
2829

2930
public final class AqlQueryExplainEntity {
3031

@@ -54,6 +55,18 @@ public Boolean getCacheable() {
5455
return cacheable;
5556
}
5657

58+
@Override
59+
public boolean equals(Object o) {
60+
if (!(o instanceof AqlQueryExplainEntity)) return false;
61+
AqlQueryExplainEntity that = (AqlQueryExplainEntity) o;
62+
return Objects.equals(plan, that.plan) && Objects.equals(plans, that.plans) && Objects.equals(warnings, that.warnings) && Objects.equals(stats, that.stats) && Objects.equals( 10000 cacheable, that.cacheable);
63+
}
64+
65+
@Override
66+
public int hashCode() {
67+
return Objects.hash(plan, plans, warnings, stats, cacheable);
68+
}
69+
5770
public static final class ExecutionPlan {
5871
private final Map<String, Object> properties = new HashMap<>();
5972
private Collection<ExecutionNode> nodes;
@@ -90,6 +103,18 @@ public Collection<String> getRules() {
90103
public Collection<ExecutionVariable> getVariables() {
91104
return variables;
92105
}
106+
107+
@Override
108+
public boolean equals(Object o) {
109+
if (!(o instanceof ExecutionPlan)) return false;
110+
ExecutionPlan that = (ExecutionPlan) o;
111+
return Objects.equals(properties, that.properties) && Objects.equals(nodes, that.nodes) && Objects.equals(estimatedCost, that.estimatedCost) && Objects.equals(collections, that.collections) && Objects.equals(rules, that.rules) && Objects.equals(variables, that.variables);
112+
}
113+
114+
@Override
115+
public int hashCode() {
116+
return Objects.hash(properties, nodes, estimatedCost, collections, rules, variables);
117+
}
93118
}
94119

95120
public static final class ExecutionNode {
@@ -103,6 +128,18 @@ public void add(String key, Object value) {
103128
public Object get(String key) {
104129
return properties.get(key);
105130
}
131+
132+
@Override
133+
public boolean equals(Object o) {
134+
if (!(o instanceof ExecutionNode)) return false;
135+
ExecutionNode that = (ExecutionNode) o;
136+
return Objects.equals(properties, that.properties);
137+
}
138+
139+
@Override
140+
public int hashCode() {
141+
return Objects.hashCode(properties);
142+
}
106143
}
107144

108145
public static final class ExecutionVariable {
@@ -116,6 +153,18 @@ public void add(String key, Object value) {
116153
public Object get(String key) {
117154
return properties.get(key);
118155
}
156+
157+
@Override
158+
public boolean equals(Object o) {
159+
if (!(o instanceof ExecutionVariable)) return false;
160+
ExecutionVariable that = (ExecutionVariable) o;
161+
return Objects.equals(properties, that.properties);
162+
}
163+
164+
@Override
165+
public int hashCode() {
166+
return Objects.hashCode(properties);
167+
}
119168
}
120169

121170
public static final class ExecutionCollection {
@@ -129,6 +178,18 @@ public void add(String key, Object value) {
129178
public Object get(String key) {
130179
return properties.get(key);
131180
}
181+
182+
@Override
183+
public boolean equals(Object o) {
184+
if (!(o instanceof ExecutionCollection)) return false;
185+
ExecutionCollection that = (ExecutionCollection) o;
186+
return Objects.equals(properties, that.properties);
187+
}
188+
189+
@Override
190+
public int hashCode() {
191+
return Objects.hashCode(properties);
192+
}
132193
}
133194

134195
public static final class ExecutionStats {
@@ -142,6 +203,18 @@ public void add(String key, Object value) {
142203
public Object get(String key) {
143204
return properties.get(key);
144205
}
206+
207+
@Override
208+
public boolean equals(Object o) {
209+
if (!(o instanceof ExecutionStats)) return false;
210+
ExecutionStats that = (ExecutionStats) o;
211+
return Objects.equals(properties, that.properties);
212+
}
213+
214+
@Override
215+
public int hashCode() {
216+
return Objects.hashCode(properties);
217+
}
145218
}
146219

147220
}

core/src/main/java/com/arangodb/entity/ArangoDBEngine.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.arangodb.entity;
2222

23+
import java.util.Objects;
24+
2325
/**
2426
* @author Michele Rastelli
2527
*/
@@ -38,6 +40,18 @@ public StorageEngineName getName() {
3840
return name;
3941
}
4042

43+
@Override
44+
public boolean equals(Object o) {
45+
if (!(o instanceof ArangoDBEngine)) return false;
46+
ArangoDBEngine that = (ArangoDBEngine) o;
47+
return name == that.name;
48+
}
49+
50+
@Override
51+
public int hashCode() {
52+
return Objects.hashCode(name);
53+
}
54+
4155
public enum StorageEngineName {
4256
mmfiles, rocksdb
4357
}

core/src/main/java/com/arangodb/entity/ArangoDBVersion.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.arangodb.entity;
2222

23+
import java.util.Objects;
24+
2325
/**
2426
* @author Mark Vollmary
2527
*/
@@ -55,4 +57,15 @@ public License getLicense() {
5557
return license;
5658
}
5759

60+
@Override
61+
public boolean equals(Object o) {
62+
if (!(o instanceof ArangoDBVersion)) return false;
63+
ArangoDBVersion that = (ArangoDBVersion) o;
64+
return Objects.equals(server, that.server) && Objects.equals(version, that.version) && license == that.license;
65+
}
66+
67+
@Override
68+
public int hashCode() {
69+
return Objects.hash(server, version, license);
70+
}
5871
}

0 commit comments

Comments
 (0)
0