private TypeToken<?> getCallTypeToken(TypeToken<?> outputType, Schema schema) {
    Schema.Type schemaType = schema.getType();

    if (schemaType == Schema.Type.RECORD || schemaType == Schema.Type.UNION) {
      return TypeToken.of(Object.class);
    }
    if (schemaType == Schema.Type.ARRAY && outputType.isArray()) {
      return getArrayType(getCallTypeToken(outputType.getComponentType(), schema.getComponentSchema()));
    }

    return outputType;
  }
private TypeToken < ? > getCallTypeToken ( TypeToken < ? > outputType , Schema schema ) { Schema . Type schemaType = schema . getType ( ) ; if ( schemaType == Schema . Type . RECORD || schemaType == Schema . Type . UNION ) { return TypeToken . of ( Object . class ) ; } if ( schemaType == Schema . Type . ARRAY && outputType . isArray ( ) ) { return getArrayType ( getCallTypeToken ( outputType . getComponentType ( ) , schema . getComponentSchema ( ) ) ) ; } return outputType ; }
Returns the type to be used on the encode method. This is needed to work with private classes
that the generated DatumWriter doesn't have access to.

@param outputType Type information of the data type for output
@param schema Schema to use for output.
@return The type information to be used for encode method.