Class UlidConverter
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.jpa.UlidConverter
-
- All Implemented Interfaces:
javax.persistence.AttributeConverter<String,byte[]>
public class UlidConverter extends Object implements javax.persistence.AttributeConverter<String,byte[]>
Serves to convert the string ULID representation of the field in the Java entity class into the byte array representation for storage in a binary field in the database. This can serve to save some memory space in the database (especially for indexed fields) at the cost of readability and easy data troubleshooting. There is a string passthrough version of this converter as well. Which version is used is determined by which library is mounted on the classpath at runtime.String fields in an entity class that should receive this persistence behaviour should be annotated with
@Convert(converter = UlidConverter.class)
.- Author:
- Jeff Fischer
-
-
Field Summary
Fields Modifier and Type Field Description static UlidConverter
INSTANCE
-
Constructor Summary
Constructors Constructor Description UlidConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
convertToDatabaseColumn(String attribute)
String
convertToEntityAttribute(byte[] dbData)
static UlidConverter
getInstance()
-
-
-
Field Detail
-
INSTANCE
public static final UlidConverter INSTANCE
-
-
Method Detail
-
getInstance
public static UlidConverter getInstance()
-
convertToDatabaseColumn
public byte[] convertToDatabaseColumn(String attribute)
- Specified by:
convertToDatabaseColumn
in interfacejavax.persistence.AttributeConverter<String,byte[]>
-
-