Skip to content

Commit

Permalink
#87 feat: UUID 변환기
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkode committed Jun 6, 2024
1 parent 6de3b72 commit 7dd96ab
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.seoultech.synergybe.domain.common.idgenerator;

import org.springframework.stereotype.Component;

import java.nio.ByteBuffer;
import java.util.UUID;

@Component
public class UUIDConverter {
// UUID를 BINARY(16)로 변환
public static byte[] toBinaryUUID(UUID uuid) {
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(uuid.getMostSignificantBits());
bb.putLong(uuid.getLeastSignificantBits());
return bb.array();
}
}

0 comments on commit 7dd96ab

Please sign in to comment.