|
22 | 22 |
|
23 | 23 | import com.arangodb.internal.serde.UserDataInside; |
24 | 24 |
|
25 | | -import java.util.Arrays; |
26 | | -import java.util.Collection; |
27 | | -import java.util.Map; |
| 25 | +import java.util.*; |
28 | 26 |
|
29 | 27 | /** |
30 | 28 | * @author Mark Vollmary |
31 | 29 | * @author Michele Rastelli |
32 | 30 | * @see <a href="https://www.arangodb.com/docs/stable/http/aql-query-cursor-accessing-cursors.html#create-cursor">API |
33 | 31 | * Documentation</a> |
34 | 32 | */ |
35 | | -public final class AqlQueryOptions { |
| 33 | +public final class AqlQueryOptions implements Cloneable { |
36 | 34 |
|
37 | 35 | private Boolean count; |
38 | 36 | private Integer ttl; |
@@ -491,7 +489,19 @@ public AqlQueryOptions streamTransactionId(final String streamTransactionId) { |
491 | 489 | return this; |
492 | 490 | } |
493 | 491 |
|
494 | | - public static final class Options { |
| 492 | + @Override |
| 493 | + public AqlQueryOptions clone() { |
| 494 | + try { |
| 495 | + AqlQueryOptions clone = (AqlQueryOptions) super.clone(); |
| 496 | + clone.bindVars = bindVars != null ? new HashMap<>(bindVars) : null; |
| 497 | + clone.options = options != null ? options.clone() : null; |
| 498 | + return clone; |
| 499 | + } catch (CloneNotSupportedException e) { |
| 500 | + throw new AssertionError(); |
| 501 | + } |
| 502 | + } |
| 503 | + |
| 504 | + public static final class Options implements Cloneable { |
495 | 505 |
|
496 | 506 | private Boolean failOnWarning; |
497 | 507 | private Boolean profile; |
@@ -577,14 +587,36 @@ public Collection<String> getShardIds() { |
577 | 587 | return shardIds; |
578 | 588 | } |
579 | 589 |
|
| 590 | + @Override |
| 591 | + public Options clone() { |
| 592 | + try { |
| 593 | + Options clone = (Options) super.clone(); |
| 594 | + clone.optimizer = optimizer != null ? optimizer.clone() : null; |
| 595 | + clone.shardIds = shardIds != null ? new ArrayList<>(shardIds) : null; |
| 596 | + return clone; |
| 597 | + } catch (CloneNotSupportedException e) { |
| 598 | + throw new AssertionError(); |
| 599 | + } |
| 600 | + } |
580 | 601 | } |
581 | 602 |
|
582 | | - public static final class Optimizer { |
| 603 | + public static final class Optimizer implements Cloneable { |
583 | 604 | private Collection<String> rules; |
584 | 605 |
|
585 | 606 | public Collection<String> getRules() { |
586 | 607 | return rules; |
587 | 608 | } |
| 609 | + |
| 610 | + @Override |
| 611 | + public Optimizer clone() { |
| 612 | + try { |
| 613 | + Optimizer clone = (Optimizer) super.clone(); |
| 614 | + clone.rules = rules != null ? new ArrayList<>(rules) : null; |
| 615 | + return clone; |
| 616 | + } catch (CloneNotSupportedException e) { |
| 617 | + throw new AssertionError(); |
| 618 | + } |
| 619 | + } |
588 | 620 | } |
589 | 621 |
|
590 | 622 | } |
0 commit comments