Class UUIDTypeHandler

  • All Implemented Interfaces:
    TypeHandler

    public class UUIDTypeHandler
    extends java.lang.Object
    implements TypeHandler
    A type handler for UUID values.
    Since:
    2.0
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      UUIDTypeHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String format​(java.lang.Object value)
      Formats a UUID by calling toString().
      java.lang.Class<?> getType()
      Returns UUID.
      java.lang.Object parse​(java.lang.String text)
      Parses a UUID using UUID.fromString(String).
      • Methods inherited from class java.lang.Object

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

      • UUIDTypeHandler

        public UUIDTypeHandler()
    • Method Detail

      • parse

        public java.lang.Object parse​(java.lang.String text)
                               throws TypeConversionException
        Parses a UUID using UUID.fromString(String).
        Specified by:
        parse in interface TypeHandler
        Parameters:
        text - the text to parse
        Returns:
        the parsed UUID or null if text is null or an empty string
        Throws:
        TypeConversionException - if the text cannot be parsed
      • format

        public java.lang.String format​(java.lang.Object value)
        Formats a UUID by calling toString(). If value is null, null is returned.
        Specified by:
        format in interface TypeHandler
        Parameters:
        value - the UUID to format
        Returns:
        the formatted text
      • getType

        public java.lang.Class<?> getType()
        Returns UUID.
        Specified by:
        getType in interface TypeHandler
        Returns:
        the class type supported by this handler