public abstract class AbstractSchemaGenerator extends Object implements SchemaGenerator
| Constructor and Description |
|---|
AbstractSchemaGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected Schema |
doGenerate(com.google.common.reflect.TypeToken<?> typeToken,
Set<String> knownRecords,
boolean acceptRecursion)
Actual schema generation.
|
Schema |
generate(Type type)
|
Schema |
generate(Type type,
boolean acceptRecursiveTypes)
|
protected abstract Schema |
generateRecord(com.google.common.reflect.TypeToken<?> typeToken,
Set<String> knownRecords,
boolean acceptRecursiveTypes)
Generates a RECORD schema of the given type.
|
public final Schema generate(Type type) throws UnsupportedTypeException
SchemaGeneratorgenerate in interface SchemaGeneratortype - The java Type for generating a Schema.Schema representing the given java Type.UnsupportedTypeException - Indicates schema generation is not supported for the given java
Type.public final Schema generate(Type type, boolean acceptRecursiveTypes) throws UnsupportedTypeException
SchemaGeneratorgenerate in interface SchemaGeneratortype - The java Type for generating a Schema.acceptRecursiveTypes - Whether to tolerate type recursion. If false, will throw UnsupportedTypeException if
a recursive type is encountered.Schema representing the given java Type.UnsupportedTypeException - Indicates schema generation is not supported for the given java
Type.protected final Schema doGenerate(com.google.common.reflect.TypeToken<?> typeToken, Set<String> knownRecords, boolean acceptRecursion) throws UnsupportedTypeException
typeToken - Encapsulate the Java type for generating a Schema.knownRecords - Set of record names that has the schema already generated. It is used for
recursive class field references.acceptRecursion - Whether to tolerate type recursion. If false, will throw UnsupportedTypeException if
a recursive type is encountered.Schema representing the given java Type.UnsupportedTypeException - Indicates schema generation is not support for the given java
Type.protected abstract Schema generateRecord(com.google.common.reflect.TypeToken<?> typeToken, Set<String> knownRecords, boolean acceptRecursiveTypes) throws UnsupportedTypeException
typeToken - Type of the record.knownRecords - Set of record names that schema has already been generated.acceptRecursiveTypes - Whether to tolerate type recursion. If false, will throw UnsupportedTypeException if
a recursive type is encountered.SchemaUnsupportedTypeExceptionCopyright © 2019 CDAP Licensed under the Apache License, Version 2.0.