Skip to content

Commit

Permalink
Add Builder to CommentEntry instead of of
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Apr 24, 2020
1 parent 3868d7b commit 1b00abc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Expand Up @@ -23,6 +23,7 @@
package de.metas.comments;

import de.metas.user.UserId;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

Expand All @@ -39,17 +40,16 @@ public class CommentEntry

@NonNull CommentEntryId id;

private CommentEntry(@NonNull final UserId createdBy, @NonNull final ZonedDateTime created, @NonNull final String text, @NonNull final CommentEntryId id)
@Builder
private CommentEntry(
@NonNull final UserId createdBy,
@NonNull final ZonedDateTime created,
@NonNull final String text,
@NonNull final CommentEntryId id)
{
this.createdBy = createdBy;
this.created = created;
this.text = text;
this.id = id;
}

@NonNull
public static CommentEntry of(@NonNull final UserId createdBy, @NonNull final ZonedDateTime created, @NonNull final String text, @NonNull final CommentEntryId id)
{
return new CommentEntry(createdBy, created, text, id);
}
}
Expand Up @@ -95,7 +95,12 @@ private static CommentEntry toRecordComment(@NonNull final I_CM_ChatEntry chatEn
final String text = chatEntry.getCharacterData();
final CommentEntryId id = CommentEntryId.ofRepoId(chatEntry.getCM_ChatEntry_ID());

return CommentEntry.of(createdBy, created, text, id);
return CommentEntry.builder()
.created(created)
.createdBy(createdBy)
.text(text)
.id(id)
.build();
}

@NonNull
Expand Down

0 comments on commit 1b00abc

Please sign in to comment.