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.StringDEFAULT_CHARSET -
Constructor Summary
Constructors Constructor Description UUIDConverter() -
Method Summary
Modifier and Type Method Description java.util.UUIDconvert(java.lang.Object source)Convert the input to a UUID using the convenience methodgetUUID(Object).static java.util.UUIDgetUUID(java.lang.Object input)Convenient utility to convert an object to a UUID.
-
Field Details
-
DEFAULT_CHARSET
public static final java.lang.String DEFAULT_CHARSET- See Also:
- Constant Field Values
-
-
Constructor Details
-
UUIDConverter
public UUIDConverter()
-
-
Method Details
-
convert
public java.util.UUID convert(java.lang.Object source)Convert the input to a UUID using the convenience methodgetUUID(Object).- Specified by:
convertin interfaceorg.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
- Parameters:
input- an Object- Returns:
- a UUID constructed from the input
-