Class JacksonMongoCollection.JacksonMongoCollectionBuilder

java.lang.Object
org.mongojack.JacksonMongoCollection.JacksonMongoCollectionBuilder
Enclosing class:
JacksonMongoCollection<TResult>

public static final class JacksonMongoCollection.JacksonMongoCollectionBuilder extends Object
Builder to build JacksonMongoCollection.
Since:
1.0
Author:
James Roper
  • Method Details

    • withObjectMapper

      public JacksonMongoCollection.JacksonMongoCollectionBuilder withObjectMapper(tools.jackson.databind.ObjectMapper objectMapper)
      Sets the object mapper for this collection. Optional
      Parameters:
      objectMapper - The object mapper to use
      Returns:
      the builder
    • withView

      Set a view class for this collection. Optional.
      Parameters:
      view - The jackson view class
      Returns:
      the builder
    • withSerializationOptions

      public JacksonMongoCollection.JacksonMongoCollectionBuilder withSerializationOptions(SerializationOptions serializationOptions)
    • build

      public <CT> JacksonMongoCollection<CT> build(com.mongodb.client.MongoClient client, String databaseName, String collectionName, Class<CT> valueType, org.bson.UuidRepresentation uuidRepresentation)
      Builds a JacksonMongoCollection. Required parameters are set here.
      Type Parameters:
      CT - The value type
      Parameters:
      client - A client
      databaseName - Name of the database the collection is in
      collectionName - Name of the collection itself
      valueType - The class of the value type
      Returns:
      A constructed collection meeting the MongoCollection interface.
    • build

      public <CT> JacksonMongoCollection<CT> build(com.mongodb.client.MongoClient client, String databaseName, Class<CT> valueType, org.bson.UuidRepresentation uuidRepresentation)
      Builds a JacksonMongoCollection. Required parameters are set here.
      Type Parameters:
      CT - The value type
      Parameters:
      client - A client
      databaseName - Name of the database the collection is in
      valueType - The class of the value type. Must be annotated with MongoCollection.
      Returns:
      A constructed collection meeting the MongoCollection interface.
    • build

      public <CT> JacksonMongoCollection<CT> build(com.mongodb.client.MongoDatabase database, String collectionName, Class<CT> valueType, org.bson.UuidRepresentation uuidRepresentation)
      Builds a JacksonMongoCollection. Required parameters are set here.
      Type Parameters:
      CT - The value type
      Parameters:
      database - A client
      collectionName - Name of the collection itself
      valueType - The class of the value type
      Returns:
      A constructed collection meeting the MongoCollection interface.
    • build

      public <CT> JacksonMongoCollection<CT> build(com.mongodb.client.MongoDatabase database, Class<CT> valueType, org.bson.UuidRepresentation uuidRepresentation)
      Builds a JacksonMongoCollection. Required parameters are set here.
      Type Parameters:
      CT - The value type
      Parameters:
      database - A client
      valueType - The class of the value type. Must be annotated with MongoCollection.
      Returns:
      A constructed collection meeting the MongoCollection interface.
    • build

      public <CT> JacksonMongoCollection<CT> build(com.mongodb.client.MongoCollection<CT> mongoCollection, Class<CT> valueType, org.bson.UuidRepresentation uuidRepresentation)
      Builds a JacksonMongoCollection. Required parameters are set here.
      Type Parameters:
      CT - The value type of the collection
      Parameters:
      mongoCollection - The underlying collection
      valueType - The value type of the collection
      Returns:
      A constructed collection