com.fasterxml.jackson.databind.ser.impl

## Class ObjectIdWriter

- java.lang.Object
- - com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter

-     public final class ObjectIdWriter
      extends java.lang.Object

  Object that knows how to serialize Object Ids.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `alwaysAsId` Marker that indicates what the first reference is to be serialized as full POJO, or as Object Id (other references will always be serialized as Object Id)
    `com.fasterxml.jackson.annotation.ObjectIdGenerator<?>` | `generator` Blueprint generator instance: actual instance will be fetched from `SerializerProvider` using this as the key.
    `JavaType` | `idType`
    `com.fasterxml.jackson.core.SerializableString` | `propertyName` Name of id property to write, if not null: if null, should only write references, but id property is handled by some other entity.
    `JsonSerializer<java.lang.Object>` | `serializer` Serializer used for serializing id values.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ObjectIdWriter(JavaType t, com.fasterxml.jackson.core.SerializableString propName, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> gen, JsonSerializer<?> ser, boolean alwaysAsId)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ObjectIdWriter` | `construct(JavaType idType, PropertyName propName, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator, boolean alwaysAsId)` Factory method called by `BeanSerializerBase` with the initial information based on standard settings for the type for which serializer is being built.
    `static ObjectIdWriter` | `construct(JavaType idType, java.lang.String propName, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator, boolean alwaysAsId)` Deprecated.
    `ObjectIdWriter` | `withAlwaysAsId(boolean newState)`
    `ObjectIdWriter` | `withSerializer(JsonSerializer<?> ser)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### idType

          public final JavaType idType

    - #### propertyName

          public final com.fasterxml.jackson.core.SerializableString propertyName

      Name of id property to write, if not null: if null, should only write references, but id property is handled by some other entity.

    - #### generator

          public final com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator

      Blueprint generator instance: actual instance will be fetched from `SerializerProvider` using this as the key.

    - #### serializer

          public final JsonSerializer<java.lang.Object> serializer

      Serializer used for serializing id values.

    - #### alwaysAsId

          public final boolean alwaysAsId

      Marker that indicates what the first reference is to be serialized as full POJO, or as Object Id (other references will always be serialized as Object Id)
      Since:
        2.1

  - ### Constructor Detail

    - #### ObjectIdWriter

          protected ObjectIdWriter(JavaType t,
                        com.fasterxml.jackson.core.SerializableString propName,
                        com.fasterxml.jackson.annotation.ObjectIdGenerator<?> gen,
                        JsonSerializer<?> ser,
                        boolean alwaysAsId)

  - ### Method Detail

    - #### construct

          public static ObjectIdWriter construct(JavaType idType,
                                 PropertyName propName,
                                 com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator,
                                 boolean alwaysAsId)

      Factory method called by `BeanSerializerBase` with the initial information based on standard settings for the type for which serializer is being built.
      Since:
        2.3

    - #### construct

          @Deprecated
          public static ObjectIdWriter construct(JavaType idType,
                                            java.lang.String propName,
                                            com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator,
                                            boolean alwaysAsId)

      Deprecated.

    - #### withSerializer

          public ObjectIdWriter withSerializer(JsonSerializer<?> ser)

    - #### withAlwaysAsId

          public ObjectIdWriter withAlwaysAsId(boolean newState)

      Since:
        2.1