All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redis.om.spring.convert.BytesToUlidConverter Maven / Gradle / Ivy

package com.redis.om.spring.convert;

import java.nio.charset.StandardCharsets;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;

import com.github.f4b6a3.ulid.Ulid;

@ReadingConverter
public class BytesToUlidConverter implements Converter {

  @Override
  public Ulid convert(byte[] source) {
    return Ulid.from(toString(source));
  }

  String toString(byte[] source) {
    return new String(source, StandardCharsets.UTF_8);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy