Interface Schema.Builder
-
- Enclosing interface:
- Schema
public static interface Schema.Builder
Allows to build aSchema
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Schema
build()
default Schema
build(Comparator<Schema.Entry> order)
Same asbuild()
but entries order is specified byorder
.default Schema.Builder
moveAfter(String after, String name)
Move an entry after another one.default Schema.Builder
moveBefore(String before, String name)
Move an entry before another one.default Schema.Builder
remove(String name)
Remove entry from builder.default Schema.Builder
remove(Schema.Entry entry)
Remove entry from builder.default Schema.Builder
swap(String name, String with)
Swap two entries.Schema.Builder
withElementSchema(Schema schema)
Schema.Builder
withEntry(Schema.Entry entry)
default Schema.Builder
withEntryAfter(String after, Schema.Entry entry)
Insert the entry after the specified entry.default Schema.Builder
withEntryBefore(String before, Schema.Entry entry)
Insert the entry before the specified entry.Schema.Builder
withProp(String key, String value)
Schema.Builder
withProps(Map<String,String> props)
Schema.Builder
withType(Schema.Type type)
-
-
-
Method Detail
-
withType
Schema.Builder withType(Schema.Type type)
- Parameters:
type
- schema type.- Returns:
- this builder.
-
withEntry
Schema.Builder withEntry(Schema.Entry entry)
- Parameters:
entry
- element for either an array or record type.- Returns:
- this builder.
-
withEntryAfter
default Schema.Builder withEntryAfter(String after, Schema.Entry entry)
Insert the entry after the specified entry.- Parameters:
after
- the entry name referenceentry
- the entry name- Returns:
- this builder
-
withEntryBefore
default Schema.Builder withEntryBefore(String before, Schema.Entry entry)
Insert the entry before the specified entry.- Parameters:
before
- the entry name referenceentry
- the entry name- Returns:
- this builder
-
remove
default Schema.Builder remove(String name)
Remove entry from builder.- Parameters:
name
- the entry name- Returns:
- this builder
-
remove
default Schema.Builder remove(Schema.Entry entry)
Remove entry from builder.- Parameters:
entry
- the entry- Returns:
- this builder
-
moveAfter
default Schema.Builder moveAfter(String after, String name)
Move an entry after another one.- Parameters:
after
- the entry name referencename
- the entry name
-
moveBefore
default Schema.Builder moveBefore(String before, String name)
Move an entry before another one.- Parameters:
before
- the entry name referencename
- the entry name
-
swap
default Schema.Builder swap(String name, String with)
Swap two entries.- Parameters:
name
- the entry namewith
- the other entry name
-
withElementSchema
Schema.Builder withElementSchema(Schema schema)
- Parameters:
schema
- nested element schema.- Returns:
- this builder.
-
withProps
Schema.Builder withProps(Map<String,String> props)
- Parameters:
props
- schema properties- Returns:
- this builder
-
withProp
Schema.Builder withProp(String key, String value)
- Parameters:
key
- the prop key namevalue
- the prop value- Returns:
- this builder
-
build
default Schema build(Comparator<Schema.Entry> order)
Same asbuild()
but entries order is specified byorder
. This takes precedence on any previous defined order with builder and may void it.- Parameters:
order
- the wanted order for entries.- Returns:
- the described schema.
-
-