Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SchemaBuilderImpl

Implementation of the SchemaBuilder interface

Hierarchy

  • SchemaBuilderImpl

Implements

Index

Constructors

constructor

  • Create a SchemaBuilderImpl

    Parameters

    • recordV2Constructor: object

      a constructor function for creating RecordV2 implementations

    Returns SchemaBuilderImpl

Properties

Private Optional currentFields

currentFields: FieldImpl[]

The fields of the current record that will be added to the records array

Private Optional currentMax

currentMax: undefined | number

The maximum multiplicity of the current record that will be added to the records array

Private Optional currentMin

currentMin: undefined | number

The minimum multiplicity of the current record that will be added to the records array

Private Optional currentName

currentName: undefined | string

The name of the current record that will be added to the records array

Private recordV2Constructor

recordV2Constructor: object

A constructor function for creating RecordV2 implementations

Type declaration

Private records

records: RecordImpl[] = []

The records that have been added to the schema

Methods

Private addRecord

  • addRecord(): void
  • Add the current record to the records array

    throws

    an error if the current record contains no fields

    Returns void

build

  • Build an immutable Schema.

    At least one record with at least one field must have been added to the builder.

    Returns SchemaImpl

    a new immutable schema object representing the current state of the builder

Private checkField

  • checkField(name: string): void
  • Check for duplicate field names or a field after a variable multiplicity field

    throws

    an error if a field with that name cannot be added

    Parameters

    • name: string

      the field name

    Returns void

Private checkRecord

  • checkRecord(name: string): void
  • Check for duplicate record names or a record after a variable multiplicity record

    throws

    an error if a record with that name cannot be added

    Parameters

    • name: string

      the record name

    Returns void

decimal

  • decimal(name: string, scale: number, min?: number, max?: number): SchemaBuilder
  • inheritdoc

    Parameters

    • name: string
    • scale: number
    • Default value min: number = 1
    • Default value max: number = min

    Returns SchemaBuilder

Private fieldIndex

  • fieldIndex(): number
  • Get the index of the next field to be added

    Returns number

    the current field index plus the current multiplicity

integer

  • integer(name: string, min?: number, max?: number): SchemaBuilder
  • inheritdoc

    Parameters

    • name: string
    • Default value min: number = 1
    • Default value max: number = min

    Returns SchemaBuilder

record

  • record(name: string, min?: number, max?: number): SchemaBuilder
  • inheritdoc

    Parameters

    • name: string
    • Default value min: number = 1
    • Default value max: number = min

    Returns SchemaBuilder

string

  • string(name: string, min?: number, max?: number): SchemaBuilder
  • inheritdoc

    Parameters

    • name: string
    • Default value min: number = 1
    • Default value max: number = min

    Returns SchemaBuilder