<commit_before>package com.google.cloud.dataflow.contrib.hadoop;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.cloud.dataflow.sdk.coders.AvroCoder;
import com.google.cloud.dataflow.sdk.coders.Coder;
import com.google.cloud.dataflow.sdk.coders.CoderException;
import com.google.cloud.dataflow.sdk.coders.StandardCoder;
import com.google.cloud.dataflow.sdk.util.CloudObject;
import com.google.cloud.dataflow.sdk.util.PropertyNames;
import com.google.common.base.Preconditions;
import org.apache.avro.mapred.AvroWrapper;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.List;

public class AvroWrapperCoder<W extends AvroWrapper<D>, D> extends StandardCoder<W> {
  private static final long serialVersionUID = 0L;

  private final Class<W> wrapperType;
  private final AvroCoder<D> datumCoder;

  private AvroWrapperCoder(Class<W> wrapperType, AvroCoder<D> datumCoder) {
    this.wrapperType = wrapperType;
    this.datumCoder = datumCoder;
  }

  public static <W extends AvroWrapper<D>, D>
  AvroWrapperCoder<W, D>of(Class<W> wrapperType, AvroCoder<D> datumCoder) {
    return new AvroWrapperCoder<>(wrapperType, datumCoder);
  }

  @JsonCreator
  @SuppressWarnings("unchecked")
  public static AvroWrapperCoder<?, ?> of(
      @JsonProperty("wrapperType") String wrapperType,<commit_msg>add JavaDoc to AvroWrapperCoder<commit_after>package com.google.cloud.dataflow.contrib.hadoop;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.cloud.dataflow.sdk.coders.AvroCoder;
import com.google.cloud.dataflow.sdk.coders.Coder;
import com.google.cloud.dataflow.sdk.coders.CoderException;
import com.google.cloud.dataflow.sdk.coders.StandardCoder;
import com.google.cloud.dataflow.sdk.util.CloudObject;
import com.google.cloud.dataflow.sdk.util.PropertyNames;
import com.google.common.base.Preconditions;
import org.apache.avro.mapred.AvroWrapper;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.List;

/**
 * A {@code AvroWrapperCoder} is a {@link com.google.cloud.dataflow.sdk.coders.Coder} for a Java
 * class that implements {@link org.apache.avro.mapred.AvroWrapper}.
 *
 * @param <W> the type of the wrapper
 * @param <D> the type of the datum
 */
public class AvroWrapperCoder<W extends AvroWrapper<D>, D> extends StandardCoder<W> {
  private static final long serialVersionUID = 0L;

  private final Class<W> wrapperType;
  private final AvroCoder<D> datumCoder;

  private AvroWrapperCoder(Class<W> wrapperType, AvroCoder<D> datumCoder) {
    this.wrapperType = wrapperType;
    this.datumCoder = datumCoder;
  }

  /**
   * Return a {@code AvroWrapperCoder} instance for the provided element class.
   * @param <W> the type of the wrapper
   * @param <D> the type of the datum
   */
  public static <W extends AvroWrapper<D>, D>
  AvroWrapperCoder<W, D>of(Class<W> wrapperType, AvroCoder<D> datumCoder) {
    return new AvroWrapperCoder<>(wrapperType, datumCoder);
  }

  @JsonCreator
  @SuppressWarnings("unchecked")
  public static AvroWrapperCoder<?, ?> of(
      @JsonProperty("wrapperType") String wrapperType,
{'fraction_non_alphanumeric': 0.1107452858425621, 'fraction_numerical': 0.000598623166716552, 'mean_word_length': 5.341555977229602, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4630656', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1098, 'n_words': 229}