public interface AttributeConverter<T, S>

Reflection-free conversion between a domain value and one SQL scalar. Implementations used by Convert must have a public no-argument constructor. Both methods receive null values and must define how to represent them.

Type parameters

<T>
domain value type
<S>
SQL scalar type declared by the mapping

Methods

public abstract S toDatabase(T value)Converts an entity field value to its stored scalar representation.
public abstract T fromDatabase(S value)Converts a stored scalar to the entity field’s domain type.

Method details

toDatabase

public abstract S toDatabase(T value)
Converts an entity field value to its stored scalar representation.

Parameters

value T
domain value, possibly null

Returns

scalar value accepted by the declared storage type, or null

fromDatabase

public abstract T fromDatabase(S value)
Converts a stored scalar to the entity field’s domain type.

Parameters

value S
stored value, possibly null

Returns

reconstructed domain value, or null