title: How do I ignore getters/setters with PojoCodecProvider
body: <p>I'm trying to setup a MongoCollection to return/save using a data transfer object pojo, but I can't figure out how to configure the pojo codec to ignore getters/setters.</p>
  
  <p>Right now I'm getting the error</p>
  
  <pre><code>Caused by: org.bson.codecs.configuration.CodecConfigurationException: Property 'iLink' in BasicRecord, has differing data types: TypeData{type=BasicLink} and TypeData{type=ILink}
  </code></pre>
  
  <p>I don't control the data transfer object, and there is no "iLink" property. (the property is just "link", and the object property name, which is already "link" is used for serialization/deserialization between systems. getILink is just a generic version of getLink inherited from an ILink interface)</p>
  
  <p>Here is my code to build the pojo codecs</p>
  
  <pre><code>    // Create a Codec for converting BsonDate to java.time.Instant
      final HashMap&lt;BsonType, Class&lt;?&gt;&gt; replacements = new HashMap&lt;&gt;();
      replacements.put(BsonType.DATE_TIME, Instant.class);
      final BsonTypeClassMap bsonTypeClassMap = new BsonTypeClassMap(replacements);
      final Codec&lt;Document&gt; instantCodec = new DocumentCodec(MongoClient.getDefaultCodecRegistry(), bsonTypeClassMap);
  
      // Create class Codec
      final CodecProvider pojoCodecProvider = PojoCodecProvider.builder().register(this.type).build();
  
      // Combine Codecs together into one registry
      final CodecRegistry pojoCodecRegistry = CodecRegistries.fromRegistries(CodecRegistries.fromCodecs(instantCodec),
              CodecRegistries.fromProviders(pojoCodecProvider), MongoClient.getDefaultCodecRegistry());
  
      final MongoDatabase database = this.client.getDatabase(database_name).withCodecRegistry(pojoCodecRegistry);
      this.collection = database.getCollection(collection_name, classType);
  </code></pre>
  
  <p>I only need for the pojo codec to use the class property fields when encoding/decoding. I have full control of building the codec part, so if I need to use reflection to build a ClassModel, that's fine. </p>
  
  <p>(This is what I've tried with the ClassModel builder, but <s>removeProperty doesn't seem to change anything</s> the exception is thrown from the constructor, so I never have a chance to call removeProperty.)</p>
  
  <pre><code>    final ClassModelBuilder&lt;T&gt; builder = ClassModel.builder(this.type);
      builder.removeProperty("iLink");
      final CodecProvider pojoCodecProvider = PojoCodecProvider.builder().register(builder.build()).build();
  </code></pre>