1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.linecorp.centraldogma.server.command;
18
19 import static java.util.Objects.requireNonNull;
20
21 import com.fasterxml.jackson.annotation.JsonCreator;
22 import com.fasterxml.jackson.annotation.JsonProperty;
23 import com.google.common.base.MoreObjects.ToStringHelper;
24
25
26
27
28
29 public final class ForcePushCommand<T> extends AdministrativeCommand<T> {
30
31 private final Command<T> delegate;
32
33 @JsonCreator
34 ForcePushCommand(@JsonProperty("delegate") Command<T> delegate) {
35 super(CommandType.FORCE_PUSH, requireNonNull(delegate, "delegate").timestamp(), delegate.author());
36 this.delegate = delegate;
37 }
38
39
40
41
42 @JsonProperty("delegate")
43 public Command<T> delegate() {
44 return delegate;
45 }
46
47 @Override
48 public boolean equals(Object o) {
49 if (this == o) {
50 return true;
51 }
52 if (!(o instanceof ForcePushCommand)) {
53 return false;
54 }
55 final ForcePushCommand<?> that = (ForcePushCommand<?>) o;
56 return super.equals(that) && delegate.equals(that.delegate);
57 }
58
59 @Override
60 public int hashCode() {
61 return super.hashCode() * 31 + delegate.hashCode();
62 }
63
64 @Override
65 ToStringHelper toStringHelper() {
66 return super.toStringHelper().add("delegate", delegate);
67 }
68 }