It's all about the answers!

Ask a question

How to cast the String to UUID? (RTC SDK)


Kenery Wang (6411827) | asked Aug 16 '13, 9:20 a.m.
edited Aug 18 '13, 11:25 a.m.
Hi guys,

I get a String type data from UUID type via ".getContextId().getUuidValue()".
Now I'd like to cast this String type to the UUID type. 
Is that possible and how to do that?

Thanks for reply!   

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Aug 16 '13, 10:06 a.m.
edited Aug 16 '13, 10:07 a.m.
see the UUID.valueOf() method

from the plain java javadoc

public static UUID valueOf(java.lang.String uuidValue)
Reconstitute a UUID from a String representation. This method will do basic heuristic checking to see if it appears to be a valid representation for our UUID. This method serves as a mechanism for a client to rebuild a UUID object by value : it is expected that the value was derived from a valid UUID instance at some point in time.

Parameters:
uuidValue - desired value for new UUID
Returns:
UUID corresponding to specified value
Throws:
java.lang.IllegalArgumentException - for invalid uuidValue

Kenery Wang selected this answer as the correct answer

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.