Skip to content

Commit

Permalink
add JsonCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyBuisset committed Sep 12, 2024
1 parent 1d0286a commit ee97608
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -15,6 +16,7 @@ public static ProgramId of(@NonNull final UUID uuid) {
return ProgramId.builder().uuid(uuid).build();
}

@JsonCreator
public static ProgramId of(@NonNull final String uuid) {
return ProgramId.of(UUID.fromString(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -15,6 +16,7 @@ public static ProjectId of(@NonNull final UUID uuid) {
return ProjectId.builder().uuid(uuid).build();
}

@JsonCreator
public static ProjectId of(@NonNull final String uuid) {
return ProjectId.of(UUID.fromString(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -15,6 +16,7 @@ public static RewardId of(@NonNull final UUID uuid) {
return RewardId.builder().uuid(uuid).build();
}

@JsonCreator
public static RewardId of(@NonNull final String uuid) {
return RewardId.of(UUID.fromString(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -15,6 +16,7 @@ public static SponsorId of(@NonNull final UUID uuid) {
return SponsorId.builder().uuid(uuid).build();
}

@JsonCreator
public static SponsorId of(@NonNull final String uuid) {
return SponsorId.of(UUID.fromString(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -15,6 +16,7 @@ public static UserId of(@NonNull final UUID uuid) {
return UserId.builder().uuid(uuid).build();
}

@JsonCreator
public static UserId of(@NonNull final String uuid) {
return UserId.of(UUID.fromString(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public abstract class UuidWrapper {
@Builder.Default
private final UUID uuid = UUID.randomUUID();

@Override
public String toString() {
return uuid.toString();
}
Expand Down

0 comments on commit ee97608

Please sign in to comment.