All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.elephantbird.mapreduce.io.ThriftWritable Maven / Gradle / Ivy

There is a newer version: 4.17
Show newest version
package com.twitter.elephantbird.mapreduce.io;

import org.apache.thrift.TBase;

import com.twitter.elephantbird.util.TypeRef;

/**
 * {@link BinaryWritable} for Thrift
 */
public class ThriftWritable> extends BinaryWritable {
  /**
   * Returns a ThriftWritable for a given Thrift class.
   */
  public static > ThriftWritable newInstance(Class tClass) {
    return new ThriftWritable(new TypeRef(tClass){});
  }

  public ThriftWritable() {
    super(null, null);
  }

  public ThriftWritable(TypeRef typeRef) {
    this(null, typeRef);
  }

  public ThriftWritable(M message, TypeRef typeRef) {
    super(message, new ThriftConverter(typeRef));
  }

  @Override
  protected BinaryConverter getConverterFor(Class clazz) {
    return ThriftConverter.newInstance(clazz);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy