Schema.TypeBOOLEAN_SCHEMA, BYTES_SCHEMA, FLOAT32_SCHEMA, FLOAT64_SCHEMA, INT16_SCHEMA, INT32_SCHEMA, INT64_SCHEMA, INT8_SCHEMA, OPTIONAL_BOOLEAN_SCHEMA, OPTIONAL_BYTES_SCHEMA, OPTIONAL_FLOAT32_SCHEMA, OPTIONAL_FLOAT64_SCHEMA, OPTIONAL_INT16_SCHEMA, OPTIONAL_INT32_SCHEMA, OPTIONAL_INT64_SCHEMA, OPTIONAL_INT8_SCHEMA, OPTIONAL_STRING_SCHEMA, STRING_SCHEMA| Constructor and Description |
|---|
ConnectSchema(Schema.Type type)
Construct a default schema for a primitive type.
|
ConnectSchema(Schema.Type type,
boolean optional,
Object defaultValue,
String name,
Integer version,
String doc)
Construct a Schema for a primitive type, setting schema parameters, struct fields, and key and value schemas to null.
|
ConnectSchema(Schema.Type type,
boolean optional,
Object defaultValue,
String name,
Integer version,
String doc,
Map<String,String> parameters,
List<Field> fields,
Schema keySchema,
Schema valueSchema)
Construct a Schema.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
defaultValue() |
String |
doc() |
boolean |
equals(Object o) |
Field |
field(String fieldName)
Get a
Field for this Schema by name. |
List<Field> |
fields()
Get the list of Fields for this Schema.
|
int |
hashCode() |
boolean |
isOptional() |
Schema |
keySchema()
Get the key schema for this map schema.
|
String |
name() |
Map<String,String> |
parameters()
Get a map of schema parameters.
|
ConnectSchema |
schema()
Return a concrete instance of the
Schema |
static Schema.Type |
schemaType(Class<?> klass)
Get the
Schema.Type associated with the given class. |
String |
toString() |
Schema.Type |
type() |
void |
validateValue(Object value)
Validate that the value can be used for this schema, i.e.
|
static void |
validateValue(Schema schema,
Object value)
Validate that the value can be used with the schema, i.e.
|
static void |
validateValue(String name,
Schema schema,
Object value) |
Schema |
valueSchema()
Get the value schema for this map or array schema.
|
Integer |
version()
Get the optional version of the schema.
|
public ConnectSchema(Schema.Type type, boolean optional, Object defaultValue, String name, Integer version, String doc, Map<String,String> parameters, List<Field> fields, Schema keySchema, Schema valueSchema)
SchemaBuilder instead.public ConnectSchema(Schema.Type type, boolean optional, Object defaultValue, String name, Integer version, String doc)
public ConnectSchema(Schema.Type type)
public Schema.Type type()
public boolean isOptional()
isOptional in interface Schemapublic Object defaultValue()
defaultValue in interface Schemapublic Integer version()
Schemapublic String doc()
public Map<String,String> parameters()
Schemaparameters in interface Schemapublic List<Field> fields()
SchemaDataException if this schema is not a
Schema.Type.STRUCT.public Field field(String fieldName)
SchemaField for this Schema by name. Throws a DataException if this schema is not a
Schema.Type.STRUCT.public Schema keySchema()
SchemaDataException if this schema is not a map.public Schema valueSchema()
SchemaDataException if this schema is not a map or array.valueSchema in interface Schemapublic static void validateValue(Schema schema, Object value)
DataException if the value is invalid.schema - Schema to testvalue - value to testpublic void validateValue(Object value)
DataException if the value is invalid.value - the value to validatepublic ConnectSchema schema()
SchemaSchemapublic static Schema.Type schemaType(Class<?> klass)
Schema.Type associated with the given class.klass - the Class whose associated schema type is to be returned