Package

io.jvm

uuid

Permalink

package uuid

This package holds the optimized Scala wrapper for java.util.UUID.

To use the wrapper, either extend the Imports trait or import this package object to bring the implicit into scope that way:

scala> import io.jvm.uuid._
import io.jvm.uuid._

scala> val foo = classOf[UUID]
foo: Class[io.jvm.uuid.UUID] = class java.util.UUID

scala> val bar = UUID(1, 2)
bar: io.jvm.uuid.UUID = 00000000-0000-0001-0000-000000000002

scala> val UUID(baz) = "00112233-4455-6677-8899-aAbBcCdDeEfF"
baz: io.jvm.uuid.UUID = 00112233-4455-6677-8899-aabbccddeeff
Source
package.scala
Linear Supertypes
Imports, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. uuid
  2. Imports
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Imports extends AnyRef

    Permalink

    This trait holds all the components required for completing the pimp-my-library pattern:

    This trait holds all the components required for completing the pimp-my-library pattern:

    • an UUID type alias
    • an UUID singleton object with static forwarders and new UUID factories
    • an implicit def to provide extensions on the legacy java.util.UUID class

    Use case is to use it by extending it with your package object:

    package com
    package object example extends io.jvm.uuid.Imports

    Now any class in the com.example package will be able to access rich UUID functionality:

    package com.example
    class User(val id: UUID = UUID.random)
  2. final class RichUUID extends AnyVal with Ordered[UUID]

    Permalink

    Pimp-my-library pattern, wrapping the underlying java.util.UUID.

    Pimp-my-library pattern, wrapping the underlying java.util.UUID.

    This class extends AnyVal, making all the extension methods have little-to-no runtime overhead.

    The pimp is complete through an implicit conversion in the Imports trait or the uuid package object.

  3. class StaticUUID extends AnyRef

    Permalink

    This class holds all static forwarders and UUID factories.

    This class holds all static forwarders and UUID factories.

    Extend this class from the client code in order to add new functionality to the library.

  4. final type UUID = java.util.UUID

    Permalink
    Definition Classes
    Imports

Value Members

  1. object StaticUUID extends StaticUUID

    Permalink

    Singleton object to be bound with the UUID value in the package object.

  2. final val UUID: StaticUUID

    Permalink
    Definition Classes
    Imports
  3. implicit final def toRichUUID(uuid: UUID): RichUUID

    Permalink
    Definition Classes
    Imports

Inherited from Imports

Inherited from AnyRef

Inherited from Any

Ungrouped