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,
java.lang.Object defaultValue,
java.lang.String name,
java.lang.Integer version,
java.lang.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,
java.lang.Object defaultValue,
java.lang.String name,
java.lang.Integer version,
java.lang.String doc,
java.util.Map<java.lang.String,java.lang.String> parameters,
java.util.List<Field> fields,
Schema keySchema,
Schema valueSchema)
Construct a Schema.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
defaultValue() |
java.lang.String |
doc() |
boolean |
equals(java.lang.Object o) |
Field |
field(java.lang.String fieldName)
Get a field for this Schema by name.
|
java.util.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.
|
java.lang.String |
name() |
java.util.Map<java.lang.String,java.lang.String> |
parameters()
Get a map of schema parameters.
|
ConnectSchema |
schema()
Return a concrete instance of the
Schema |
static Schema.Type |
schemaType(java.lang.Class<?> klass)
Get the
Schema.Type associated with the given class. |
java.lang.String |
toString() |
Schema.Type |
type() |
void |
validateValue(java.lang.Object value)
Validate that the value can be used for this schema, i.e.
|
static void |
validateValue(Schema schema,
java.lang.Object value)
Validate that the value can be used with the schema, i.e.
|
static void |
validateValue(java.lang.String name,
Schema schema,
java.lang.Object value) |
Schema |
valueSchema()
Get the value schema for this map or array schema.
|
java.lang.Integer |
version()
Get the optional version of the schema.
|
public ConnectSchema(Schema.Type type, boolean optional, java.lang.Object defaultValue, java.lang.String name, java.lang.Integer version, java.lang.String doc, java.util.Map<java.lang.String,java.lang.String> parameters, java.util.List<Field> fields, Schema keySchema, Schema valueSchema)
SchemaBuilder
instead.public ConnectSchema(Schema.Type type, boolean optional, java.lang.Object defaultValue, java.lang.String name, java.lang.Integer version, java.lang.String doc)
public ConnectSchema(Schema.Type type)
public Schema.Type type()
public boolean isOptional()
isOptional
in interface Schema
public java.lang.Object defaultValue()
defaultValue
in interface Schema
public java.lang.String name()
public java.lang.Integer version()
Schema
public java.lang.String doc()
public java.util.Map<java.lang.String,java.lang.String> parameters()
Schema
parameters
in interface Schema
public java.util.List<Field> fields()
Schema
public Field field(java.lang.String fieldName)
Schema
public Schema keySchema()
Schema
public Schema valueSchema()
Schema
valueSchema
in interface Schema
public static void validateValue(Schema schema, java.lang.Object value)
schema
- Schema to testvalue
- value to testpublic static void validateValue(java.lang.String name, Schema schema, java.lang.Object value)
public void validateValue(java.lang.Object value)
value
- the value to validatepublic ConnectSchema schema()
Schema
Schema
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static Schema.Type schemaType(java.lang.Class<?> klass)
Schema.Type
associated with the given class.klass
- the Class to