/** Register a schema for a specific {@link Class} type. */ public <T> void registerSchemaForClass( Class<T> clazz, Schema schema, SerializableFunction<T, Row> toRow, SerializableFunction<Row, T> fromRow) { registerSchemaForType(TypeDescriptor.of(clazz), schema, toRow, fromRow); }
@Test public void testRegisterForType() throws NoSuchSchemaException { SchemaRegistry registry = SchemaRegistry.createDefault(); registry.registerSchemaForType( TypeDescriptors.strings(), STRING_SCHEMA, s -> Row.withSchema(STRING_SCHEMA).addValue(s).build(), r -> r.getString("string")); registry.registerSchemaForType( TypeDescriptors.integers(), INTEGER_SCHEMA, s -> Row.withSchema(INTEGER_SCHEMA).addValue(s).build(), r -> r.getInt32("integer")); tryGetters(registry); }