@Nullable @Override public <T> SerializableFunction<Row, T> fromRowFunction(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = providers.get(typeDescriptor); return (schemaProvider != null) ? schemaProvider.fromRowFunction(typeDescriptor) : null; } }
@Nullable @Override public <T> Schema schemaFor(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = providers.get(typeDescriptor); return (schemaProvider != null) ? schemaProvider.schemaFor(typeDescriptor) : null; }
@Nullable @Override public <T> SerializableFunction<T, Row> toRowFunction(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = providers.get(typeDescriptor); return (schemaProvider != null) ? schemaProvider.toRowFunction(typeDescriptor) : null; }
/** Retrieve the function that converts a {@link Row} object to the specified type. */ public <T> SerializableFunction<Row, T> getFromRowFunction(TypeDescriptor<T> typeDescriptor) throws NoSuchSchemaException { SchemaEntry entry = entries.get(typeDescriptor); if (entry != null) { return entry.fromRow; } return getProviderResult((SchemaProvider p) -> p.fromRowFunction(typeDescriptor)); }
/** * Given a type, return a function that converts that type to a {@link Row} object If no schema * exists, returns null. */ @Override public <T> SerializableFunction<T, Row> toRowFunction(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = getSchemaProvider(typeDescriptor); return (schemaProvider != null) ? schemaProvider.toRowFunction(typeDescriptor) : null; }
@Override public <T> Schema schemaFor(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = getSchemaProvider(typeDescriptor); return (schemaProvider != null) ? schemaProvider.schemaFor(typeDescriptor) : null; }
/** * Given a type, returns a function that converts from a {@link Row} object to that type. If no * schema exists, returns null. */ @Override public <T> SerializableFunction<Row, T> fromRowFunction(TypeDescriptor<T> typeDescriptor) { SchemaProvider schemaProvider = getSchemaProvider(typeDescriptor); return (schemaProvider != null) ? schemaProvider.fromRowFunction(typeDescriptor) : null; } }
/** Rerieve the function that converts an object of the specified type to a {@link Row} object. */ public <T> SerializableFunction<T, Row> getToRowFunction(TypeDescriptor<T> typeDescriptor) throws NoSuchSchemaException { SchemaEntry entry = entries.get(typeDescriptor); if (entry != null) { return entry.toRow; } return getProviderResult((SchemaProvider p) -> p.toRowFunction(typeDescriptor)); }
/** * Retrieve a schema for a given {@link TypeDescriptor} type. If no schema exists, throws {@link * NoSuchSchemaException}. */ public <T> Schema getSchema(TypeDescriptor<T> typeDescriptor) throws NoSuchSchemaException { SchemaEntry entry = entries.get(typeDescriptor); if (entry != null) { return entry.schema; } return getProviderResult((SchemaProvider p) -> p.schemaFor(typeDescriptor)); }