Class EnumUuidConverters.StringToRef

java.lang.Object
su.onno.spring.EnumUuidConverters.StringToRef
All Implemented Interfaces:
org.springframework.core.convert.converter.GenericConverter
Enclosing class:
EnumUuidConverters

@ReadingConverter public static final class EnumUuidConverters.StringToRef extends Object implements org.springframework.core.convert.converter.GenericConverter
Reads a Ref back from a varchar column that holds the referenced id as text.

The Ref → uuid column is the norm, but a column that pre-existed as varchar (e.g. an attribute retyped from String to Ref<T>) hands the id back as a String. This mirrors EnumUuidConverters.StringToEnum for the reference case so such legacy and migrated columns round-trip instead of throwing.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter

    org.springframework.core.convert.converter.GenericConverter.ConvertiblePair
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
     
    Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringToRef

      public StringToRef()
  • Method Details

    • getConvertibleTypes

      public Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()
      Specified by:
      getConvertibleTypes in interface org.springframework.core.convert.converter.GenericConverter
    • convert

      @Nullable public Object convert(@Nullable Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
      Specified by:
      convert in interface org.springframework.core.convert.converter.GenericConverter