public final class ReflectionSchemaGenerator extends AbstractSchemaGenerator
If the given type is a class, it will uses the class fields (includes all the fields in parent classes) to generate the schema. All fields, no matter what access it is would be included, except transient or synthetic one.
If the given type is an interface, it will uses all getter methods (methods that prefix with "get" or "is",
followed by a name with no arguments) to generate fields for the record schema.
E.g. for the method String getFirstName(), a field name "firstName" of type String would be generated.
| Constructor and Description |
|---|
ReflectionSchemaGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected Schema |
generateRecord(com.google.common.reflect.TypeToken<?> typeToken,
Set<String> knowRecords,
boolean acceptRecursion)
Generates a RECORD schema of the given type.
|
doGenerate, generate, generateprotected Schema generateRecord(com.google.common.reflect.TypeToken<?> typeToken, Set<String> knowRecords, boolean acceptRecursion) throws UnsupportedTypeException
AbstractSchemaGeneratorgenerateRecord in class AbstractSchemaGeneratortypeToken - Type of the record.knowRecords - Set of record names that schema has already been generated.acceptRecursion - 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.