title: Avro ReflectData override record definition to logical type
body: <p>Am using ReflectData to generate a schema from a Java class. 
  One of the fields is </p>
  
  <pre><code>private LocalDate localDate;
  </code></pre>
  
  <p>and the reflectData generates equivalent code as a record</p>
  
  <pre><code>   {  
       "name":"localDate",
       "type":[  
          "null",
          {  
             "type":"record",
             "name":"LocalDate",
             "namespace":"java.time",
             "fields":[  
  
             ]
          }
       ],
       "default":null
    }
  </code></pre>
  
  <p>I would like to override the behavior on the class using some operations on the schema below so that </p>
  
  <pre><code> final Schema schema = ReflectData.AllowNull.get().getSchema(cls). ?;
  </code></pre>
  
  <p>the resultant schema is referencing the logical type date as below instead</p>
  
  <pre><code> {
      "name" : "localDate",
      "type" : [ "null", {
        "type" : "int",
        "logicalType" : "date"
      } ],
      "default" : null
    }
  </code></pre>
  
  <p>...</p>
  
  <p>Added some more attempts</p>
  
  <pre><code> // given a java object
   @Data
   public class JavaPojo {
  
  
      @AvroEncode(using = DateAsLongEncoding.class)
      private Date javaDate;
  
      @AvroEncode(using = DateAsLongEncoding.class)
      private LocalDateTime javaLocalDateTime;
  
   }
   ...
   // and an instance of it
   JavaPojo javaPojo = new JavaPojo();
   javaPojo.setJavaDate(new Date());
   javaPojo.setJavaLocalDateTime(LocalDateTime.now())
  ...
   // use relfection to generate the schema and eventually store it as parquet with a logicalType mapping
   Schema schema = ReflectData.AllowNull.get().getSchema(JavaPojo.class);
   // attempted to toggle on timeSupport as well
   GenericData timeSupport = new GenericData();
   timeSupport.addLogicalTypeConversion(new TimeConversions.DateConversion());
  
   ParquetWriter&lt;JavaPojo&gt; avroParquetWriter =  
                          AvroParquetWriter.&lt;JavaPojo&gt; builder(fsPath)
                                                  .withSchema(schema)
                                                  .withDataModel(ReflectData.get())
  .withDataModel(timeSupport)
  .withCompressionCodec(ompressionCodecName.SNAPPY)
                                                  .build();
  
  ...
   // fails with the below when no timeSupport is set
  java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Number
  or similarly with LocalDateTime
  
  // fails with the below when timeSupport is added
  java.lang.ClassCastException: JavaPojo cannot be cast to org.apache.avro.generic.IndexedRecord
  
  
  
  </code></pre>