ObjectIdGenerators.UUIDGenerator (Jackson-annotations 2.1.0 API)
Date: 2012-10-05

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fasterxml.jackson.annotation
Class ObjectIdGenerators.UUIDGenerator

    java.lang.Object
      com.fasterxml.jackson.annotation.ObjectIdGenerator<T>
          com.fasterxml.jackson.annotation.ObjectIdGenerators.UUIDGenerator

Enclosing class:
  ObjectIdGenerators

    public static final class ObjectIdGenerators.UUIDGenerator

extends ObjectIdGenerator<T>

Implementation that just uses `UUID`s as reliably unique identifiers: downside is that resulting String is 36 characters long.

One difference to other generators is that scope is always set as `Object.class` (regardless of arguments): this because UUIDs are globally unique, and scope has no meaning.

Nested Class Summary

Nested classes/interfaces inherited from class com.fasterxml.jackson.annotation.ObjectIdGenerator
`ObjectIdGenerator.IdKey`

Constructor Summary
`ObjectIdGenerators.UUIDGenerator()`

Method Summary
`boolean` | `canUseFor(ObjectIdGenerator<?> gen)` Since UUIDs are always unique, let's fully ignore scope definition
`ObjectIdGenerator<UUID>` | `forScope(Class<?> scope)` Can just return base instance since this is essentially scopeless
`UUID` | `generateId(Object forPojo)` Method used for generating a new Object Identifier to serialize for given POJO.
`ObjectIdGenerator.IdKey` | `key(Object key)` Method for constructing key to use for ObjectId-to-POJO maps.
`ObjectIdGenerator<UUID>` | `newForSerialization(Object context)` Can just return base instance since this is essentially scopeless

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ObjectIdGenerators.UUIDGenerator

    public ObjectIdGenerators.UUIDGenerator()

Method Detail

### forScope

    public ObjectIdGenerator<UUID> forScope(Class<?> scope)

  Can just return base instance since this is essentially scopeless

  Specified by:
    `forScope` in class `ObjectIdGenerator<UUID>`

### newForSerialization

    public ObjectIdGenerator<UUID> newForSerialization(Object context)

  Can just return base instance since this is essentially scopeless

  Specified by:
    `newForSerialization` in class `ObjectIdGenerator<UUID>`
  Parameters:
    `context` - Serialization context object used (of type `com.fasterxml.jackson.databind.SerializerProvider`; may be needed by more complex generators to access contextual information such as configuration.

### generateId

    public UUID generateId(Object forPojo)

  Description copied from class: `ObjectIdGenerator`
  Method used for generating a new Object Identifier to serialize for given POJO.

  Parameters:
    `forPojo` - POJO for which identifier is needed
  Returns:
    Object Identifier to use.

### key

    public ObjectIdGenerator.IdKey key(Object key)

  Description copied from class: `ObjectIdGenerator`
  Method for constructing key to use for ObjectId-to-POJO maps.

  Specified by:
    `key` in class `ObjectIdGenerator<UUID>`

### canUseFor

    public boolean canUseFor(ObjectIdGenerator<?> gen)

  Since UUIDs are always unique, let's fully ignore scope definition

  Returns:
    True if this instance can be used as-is; false if not

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 FasterXML. All Rights Reserved.