SchemaRegistry { public <T> SchemaCoder<T> getSchemaCoder(Class<T> clazz) throws NoSuchSchemaException { return getSchemaCoder(TypeDescriptor.of(clazz)); } private  SchemaRegistry(); static SchemaRegistry createDefault(); void registerSchemaForClass(
      Class<T> clazz,
      Schema schema,
      SerializableFunction<T, Row> toRow,
      SerializableFunction<Row, T> fromRow); void registerSchemaForType(
      TypeDescriptor<T> type,
      Schema schema,
      SerializableFunction<T, Row> toRow,
      SerializableFunction<Row, T> fromRow); void registerSchemaProvider(SchemaProvider schemaProvider); void registerSchemaProvider(Class<T> clazz, SchemaProvider schemaProvider); void registerSchemaProvider(
      TypeDescriptor<T> typeDescriptor, SchemaProvider schemaProvider); void registerPOJO(Class<T> clazz); void registerPOJO(TypeDescriptor<T> typeDescriptor); void registerJavaBean(Class<T> clazz); void registerJavaBean(TypeDescriptor<T> typeDescriptor); Schema getSchema(Class<T> clazz); Schema getSchema(TypeDescriptor<T> typeDescriptor); SerializableFunction<T, Row> getToRowFunction(Class<T> clazz); SerializableFunction<T, Row> getToRowFunction(TypeDescriptor<T> typeDescriptor); SerializableFunction<Row, T> getFromRowFunction(Class<T> clazz); SerializableFunction<Row, T> getFromRowFunction(TypeDescriptor<T> typeDescriptor); SchemaCoder<T> getSchemaCoder(Class<T> clazz); SchemaCoder<T> getSchemaCoder(TypeDescriptor<T> typeDescriptor);  }
@Test public void testGetSchemaCoder() throws NoSuchSchemaException { SchemaRegistry registry = SchemaRegistry.createDefault(); registry.registerJavaBean(SimpleBean.class); Schema schema = registry.getSchema(SimpleBean.class); SerializableFunction<SimpleBean, Row> toRowFunction = registry.getToRowFunction(SimpleBean.class); SerializableFunction<Row, SimpleBean> fromRowFunction = registry.getFromRowFunction(SimpleBean.class); SchemaCoder schemaCoder = registry.getSchemaCoder(SimpleBean.class); assertTrue(schema.equivalent(schemaCoder.getSchema())); assertTrue(toRowFunction.equals(schemaCoder.getToRowFunction())); assertTrue(fromRowFunction.equals(schemaCoder.getFromRowFunction())); thrown.expect(NoSuchSchemaException.class); registry.getSchemaCoder(Double.class); }