Class ObjectIdSerializer

java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<org.bson.types.ObjectId>
org.craftercms.commons.jackson.ObjectIdSerializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable

public class ObjectIdSerializer extends com.fasterxml.jackson.databind.JsonSerializer<org.bson.types.ObjectId>
Custom Jackson serializer for ObjectIds, which serializes an ObjectId as a String by calling ObjectId.toString().
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

    com.fasterxml.jackson.databind.JsonSerializer.None
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Class<org.bson.types.ObjectId>
     
    void
    serialize(org.bson.types.ObjectId objectId, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
     

    Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

    acceptJsonFormatVisitor, getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ObjectIdSerializer

      public ObjectIdSerializer()
  • Method Details

    • serialize

      public void serialize(org.bson.types.ObjectId objectId, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException
      Specified by:
      serialize in class com.fasterxml.jackson.databind.JsonSerializer<org.bson.types.ObjectId>
      Throws:
      IOException
    • handledType

      public Class<org.bson.types.ObjectId> handledType()
      Overrides:
      handledType in class com.fasterxml.jackson.databind.JsonSerializer<org.bson.types.ObjectId>