Class UUIDConverter

java.lang.Object
org.springframework.integration.util.UUIDConverter
All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<java.lang.Object,​java.util.UUID>

public class UUIDConverter
extends java.lang.Object
implements org.springframework.core.convert.converter.Converter<java.lang.Object,​java.util.UUID>
Utility to help generate UUID instances from generic objects.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DEFAULT_CHARSET  
  • Constructor Summary

    Constructors 
    Constructor Description
    UUIDConverter()  
  • Method Summary

    Modifier and Type Method Description
    java.util.UUID convert​(java.lang.Object source)
    Convert the input to a UUID using the convenience method getUUID(Object).
    static java.util.UUID getUUID​(java.lang.Object input)
    Convenient utility to convert an object to a UUID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.core.convert.converter.Converter

    andThen
  • Field Details

  • Constructor Details

  • Method Details

    • convert

      public java.util.UUID convert​(java.lang.Object source)
      Convert the input to a UUID using the convenience method getUUID(Object).
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<java.lang.Object,​java.util.UUID>
      See Also:
      Converter.convert(java.lang.Object)
    • getUUID

      public static java.util.UUID getUUID​(java.lang.Object input)
      Convenient utility to convert an object to a UUID. If the input is
      • null: returns null
      • a UUID: returns the input unchanged
      • a String formatted as a UUID: returns the result of UUID.fromString(String)
      • any other String: returns UUID.nameUUIDFromBytes(byte[]) with bytes generated from the input
      • a primitive or primitive wrapper: converts to a String ans then uses the previous conversion method
      • Serializable: returns the UUID.nameUUIDFromBytes(byte[]) with the serialized bytes of the input
      If none of the above applies there will be an exception trying to serialize.
      Parameters:
      input - an Object
      Returns:
      a UUID constructed from the input