Schema.Type
BOOLEAN_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. that its type matches the schema type and optional
requirements.
|
static void |
validateValue(Schema schema,
Object value)
Validate that the value can be used with the schema, i.e. that its type matches the schema type and nullability
requirements.
|
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 Schema
public Object defaultValue()
defaultValue
in interface Schema
public Integer version()
Schema
public String doc()
public Map<String,String> parameters()
Schema
parameters
in interface Schema
public List<Field> fields()
Schema
public Field field(String fieldName)
Schema
public Schema keySchema()
Schema
public Schema valueSchema()
Schema
valueSchema
in interface Schema
public static void validateValue(Schema schema, Object value)
schema
- Schema to testvalue
- value to testpublic void validateValue(Object value)
value
- the value to validatepublic ConnectSchema schema()
Schema
Schema
public static Schema.Type schemaType(Class<?> klass)
Schema.Type
associated with the given class.klass
- the Class to