Improve entity constructors

This commit is contained in:
Paul Schaub 2019-12-22 00:13:54 +01:00
parent 80579e5e8d
commit 1a973fe725
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
5 changed files with 27 additions and 4 deletions

View File

@ -12,7 +12,11 @@ public class IAccount implements Account {
protected boolean enabled;
public IAccount() {
this.id = UUID.randomUUID();
this(UUID.randomUUID());
}
public IAccount(UUID id) {
this.id = id;
}
@Override

View File

@ -13,7 +13,11 @@ public class IDirectChat implements DirectChat {
protected ChatPreferences preferences;
public IDirectChat() {
this.id = UUID.randomUUID();
this(UUID.randomUUID());
}
public IDirectChat(UUID id) {
this.id = id;
}
@Override

View File

@ -16,7 +16,11 @@ public class IGroupChat implements GroupChat {
protected Set<Peer> participants;
public IGroupChat() {
this.id = UUID.randomUUID();
this(UUID.randomUUID());
}
public IGroupChat(UUID id) {
this.id = id;
}
@Override

View File

@ -15,7 +15,11 @@ public class IPeer implements Peer {
protected boolean approved;
public IPeer() {
this.id = UUID.randomUUID();
this(UUID.randomUUID());
}
public IPeer(UUID id) {
this.id = id;
}
@Override

View File

@ -15,6 +15,13 @@ public class IMessage implements Message {
protected MessageMetadata metadata;
protected MessageDirection direction;
public IMessage() {
this(UUID.randomUUID());
}
public IMessage(UUID id) {
this.id = id;
}
@Override
public UUID getId() {