src/Pure/General/uuid.scala
author wenzelm
Sat, 01 Jun 2019 11:29:59 +0200
changeset 70299 83774d669b51
parent 69458 5655af3ea5bd
child 73133 497e11537d48
permissions -rw-r--r--
Added tag Isabelle2019-RC4 for changeset ad2d84c42380

/*  Title:      Pure/General/uuid.scala
    Author:     Makarius

Universally unique identifiers.
*/

package isabelle


object UUID
{
  type T = java.util.UUID

  def random(): T = java.util.UUID.randomUUID()
  def random_string(): String = random().toString

  def unapply(s: String): Option[T] =
    try { Some(java.util.UUID.fromString(s)) }
    catch { case _: IllegalArgumentException => None }
}