use of javax.persistence.Converter in project hibernate-orm by hibernate.
the class AttributeConverterDefinition method from.
/**
* Build an AttributeConverterDefinition from an AttributeConverter instance. The
* converter is searched for a {@link Converter} annotation to determine whether it should
* be treated as auto-apply. If the annotation is present, {@link Converter#autoApply()} is
* used to make that determination. If the annotation is not present, {@code false} is assumed.
*
* @param attributeConverter The AttributeConverter instance
*
* @return The constructed definition
*/
public static AttributeConverterDefinition from(AttributeConverter attributeConverter) {
boolean autoApply = false;
Converter converterAnnotation = attributeConverter.getClass().getAnnotation(Converter.class);
if (converterAnnotation != null) {
autoApply = converterAnnotation.autoApply();
}
return new AttributeConverterDefinition(attributeConverter, autoApply);
}
Aggregations