Package org.apache.avro.specific

Examples of org.apache.avro.specific.SpecificData


  @Test public void testClassLoader() throws Exception {
    ClassLoader loader = new ClassLoader() {};

    SpecificResponder responder
      = new SpecificResponder(Simple.class, new TestImpl(),
                              new SpecificData(loader));
    assertEquals(responder.getSpecificData().getClassLoader(), loader);

    SpecificRequestor requestor
      = new SpecificRequestor(Simple.class, client, new SpecificData(loader));
    assertEquals(requestor.getSpecificData().getClassLoader(), loader);
  }
View Full Code Here


   
    if (!EventWriter.VERSION.equals(version)) {
      throw new IOException("Incompatible event log version: "+version);
    }

    Schema myschema = new SpecificData(Event.class.getClassLoader()).getSchema(Event.class);
    this.schema = Schema.parse(in.readLine());
    this.reader = new SpecificDatumReader(schema, myschema);
    this.decoder = DecoderFactory.get().jsonDecoder(schema, in);
  }
View Full Code Here

      case REFLECT:
        return new ReflectDatumReader<T>(schema);
      case SPECIFIC:
        if (specificLoader != null) {
          return new SpecificDatumReader<T>(
              schema, schema, new SpecificData(specificLoader));
        } else {
          return new SpecificDatumReader<T>(schema);
        }
      default:
        return new GenericDatumReader<T>(schema);
View Full Code Here

          return new ReflectDatumReader<T>(schema);
        }
      case SPECIFIC:
        if (specificLoader != null) {
          return new SpecificDatumReader<T>(
              schema, schema, new SpecificData(specificLoader));
        } else {
          return new SpecificDatumReader<T>(schema);
        }
      default:
        return new GenericDatumReader<T>(schema);
View Full Code Here

      // type class here isn't necessarily a SpecificData class, it
      // might just contain one as a subtype.
      return new SpecificDatumReader<T>(
                        avroType.getSchema(),
                        avroType.getSchema(),
                        new SpecificData(avroType.getClass().getClassLoader()));
    } else {
      return new GenericDatumReader<T>(avroType.getSchema());
    }
  }
View Full Code Here

/** {@link org.apache.avro.ipc.Responder Responder} for generated interfaces.*/
public class SpecificResponder extends GenericResponder {
  private Object impl;

  public SpecificResponder(Class iface, Object impl) {
    this(iface, impl, new SpecificData(impl.getClass().getClassLoader()));
  }
View Full Code Here

  public SpecificResponder(Class iface, Object impl) {
    this(iface, impl, new SpecificData(impl.getClass().getClassLoader()));
  }
   
  public SpecificResponder(Protocol protocol, Object impl) {
    this(protocol, impl, new SpecificData(impl.getClass().getClassLoader()));
  }
View Full Code Here

public class SpecificRequestor extends Requestor implements InvocationHandler {
  SpecificData data;

  public SpecificRequestor(Class<?> iface, Transceiver transceiver)
    throws IOException {
    this(iface, transceiver, new SpecificData(iface.getClassLoader()));
  }
View Full Code Here

  /** Create a proxy instance whose methods invoke RPCs. */
  public static  <T> T getClient(Class<T> iface, Transceiver transciever)
    throws IOException {
    return getClient(iface, transciever,
                     new SpecificData(iface.getClassLoader()));
  }
View Full Code Here

import org.apache.avro.specific.SpecificRecord;

public class SpecificDatumTextReader<T> extends GenericDatumTextReader<T> {

  public SpecificDatumTextReader(Class<T> c) {
    this(c, new SpecificData(c.getClassLoader()));
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.specific.SpecificData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.