This repository has been archived by the owner on May 9, 2019. It is now read-only.
/
PItemCommand.java
74 lines (54 loc) · 1.76 KB
/
PItemCommand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.example.auction.item.impl;
import akka.Done;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.lightbend.lagom.javadsl.persistence.PersistentEntity;
import com.lightbend.lagom.serialization.Jsonable;
import java.util.Optional;
import java.util.UUID;
public interface PItemCommand extends Jsonable {
enum GetItem implements PItemCommand, PersistentEntity.ReplyType<Optional<PItem>> {
INSTANCE
}
final class CreateItem implements PItemCommand, PersistentEntity.ReplyType<Done> {
private final PItem item;
@JsonCreator
public CreateItem(PItem item) {
this.item = item;
}
public PItem getItem() {
return item;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CreateItem that = (CreateItem) o;
return item.equals(that.item);
}
@Override
public int hashCode() {
return item.hashCode();
}
}
final class StartAuction implements PItemCommand, PersistentEntity.ReplyType<Done> {
private final UUID userId;
@JsonCreator
public StartAuction(UUID userId) {
this.userId = userId;
}
public UUID getUserId() {
return userId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StartAuction that = (StartAuction) o;
return userId.equals(that.userId);
}
@Override
public int hashCode() {
return userId.hashCode();
}
}
}