public static class SchemaBuilder.BaseTypeBuilder<R> extends Object
SchemaBuilder.TypeBuilder
can additionally build
Unions.
The builder has two contexts:
type(String)
SchemaBuilder.MapBuilder.values()
will have a completion context assigned by the
SchemaBuilder.MapBuilder
Modifier and Type | Method and Description |
---|---|
SchemaBuilder.ArrayBuilder<R> |
array()
Build an Avro array type Example usage:
|
SchemaBuilder.BooleanBuilder<R> |
booleanBuilder()
Build a boolean type that can set custom properties.
|
R |
booleanType()
A plain boolean type without custom properties.
|
SchemaBuilder.BytesBuilder<R> |
bytesBuilder()
Build a bytes type that can set custom properties.
|
R |
bytesType()
A plain bytes type without custom properties.
|
SchemaBuilder.DoubleBuilder<R> |
doubleBuilder()
Build a double type that can set custom properties.
|
R |
doubleType()
A plain double type without custom properties.
|
SchemaBuilder.EnumBuilder<R> |
enumeration(String name)
Build an Avro enum type.
|
SchemaBuilder.FixedBuilder<R> |
fixed(String name)
Build an Avro fixed type.
|
SchemaBuilder.FloatBuilder<R> |
floatBuilder()
Build a float type that can set custom properties.
|
R |
floatType()
A plain float type without custom properties.
|
SchemaBuilder.IntBuilder<R> |
intBuilder()
Build an int type that can set custom properties.
|
R |
intType()
A plain int type without custom properties.
|
SchemaBuilder.LongBuilder<R> |
longBuilder()
Build a long type that can set custom properties.
|
R |
longType()
A plain long type without custom properties.
|
SchemaBuilder.MapBuilder<R> |
map()
Build an Avro map type Example usage:
|
protected SchemaBuilder.BaseTypeBuilder<R> |
nullable()
A shortcut for building a union of a type and null.
|
SchemaBuilder.NullBuilder<R> |
nullBuilder()
Build a null type that can set custom properties.
|
R |
nullType()
A plain null type without custom properties.
|
SchemaBuilder.RecordBuilder<R> |
record(String name)
Build an Avro record type.
|
SchemaBuilder.StringBldr<R> |
stringBuilder()
Build a string type that can set custom properties.
|
R |
stringType()
A plain string type without custom properties.
|
R |
type(Schema schema)
Use the schema provided as the type.
|
R |
type(String name)
Look up the type by name.
|
R |
type(String name,
String namespace)
Look up the type by name and namespace.
|
protected SchemaBuilder.BaseTypeBuilder<SchemaBuilder.UnionAccumulator<R>> |
unionOf()
Build an Avro union schema type.
|
public final R type(String name)
public final R type(String name, String namespace)
public final R booleanType()
booleanBuilder().endBoolean();
public final SchemaBuilder.BooleanBuilder<R> booleanBuilder()
booleanType()
.public final R intType()
intBuilder().endInt();
public final SchemaBuilder.IntBuilder<R> intBuilder()
intType()
.public final R longType()
longBuilder().endLong();
public final SchemaBuilder.LongBuilder<R> longBuilder()
longType()
.public final R floatType()
floatBuilder().endFloat();
public final SchemaBuilder.FloatBuilder<R> floatBuilder()
floatType()
.public final R doubleType()
doubleBuilder().endDouble();
public final SchemaBuilder.DoubleBuilder<R> doubleBuilder()
doubleType()
.public final R stringType()
stringBuilder().endString();
public final SchemaBuilder.StringBldr<R> stringBuilder()
stringType()
.public final R bytesType()
bytesBuilder().endBytes();
public final SchemaBuilder.BytesBuilder<R> bytesBuilder()
bytesType()
.public final R nullType()
nullBuilder().endNull();
public final SchemaBuilder.NullBuilder<R> nullBuilder()
nullType()
.public final SchemaBuilder.MapBuilder<R> map()
map().values().intType()Equivalent to Avro JSON Schema:
{"type":"map", "values":"int"}
public final SchemaBuilder.ArrayBuilder<R> array()
array().items().longType()Equivalent to Avro JSON Schema:
{"type":"array", "values":"long"}
public final SchemaBuilder.FixedBuilder<R> fixed(String name)
fixed("com.foo.IPv4").size(4)Equivalent to Avro JSON Schema:
{"type":"fixed", "name":"com.foo.IPv4", "size":4}
public final SchemaBuilder.EnumBuilder<R> enumeration(String name)
enumeration("Suits").namespace("org.cards").doc("card suit names") .symbols("HEART", "SPADE", "DIAMOND", "CLUB")Equivalent to Avro JSON Schema:
{"type":"enum", "name":"Suits", "namespace":"org.cards", "doc":"card suit names", "symbols":[ "HEART", "SPADE", "DIAMOND", "CLUB"]}
public final SchemaBuilder.RecordBuilder<R> record(String name)
record("com.foo.Foo").fields() .name("field1").typeInt().intDefault(1) .name("field2").typeString().noDefault() .name("field3").optional().typeFixed("FooFixed").size(4) .endRecord()Equivalent to Avro JSON Schema:
{"type":"record", "name":"com.foo.Foo", "fields": [ {"name":"field1", "type":"int", "default":1}, {"name":"field2", "type":"string"}, {"name":"field3", "type":[ null, {"type":"fixed", "name":"FooFixed", "size":4} ]} ]}
protected SchemaBuilder.BaseTypeBuilder<SchemaBuilder.UnionAccumulator<R>> unionOf()
unionOf().stringType().and().bytesType().endUnion()
protected SchemaBuilder.BaseTypeBuilder<R> nullable()
nullable().booleanType()
unionOf().booleanType().and().nullType().endUnion()
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.