Interface IndexSchema.Builder

All Known Implementing Classes:
DefaultIndexSchema.Builder
Enclosing interface:
IndexSchema

public static interface IndexSchema.Builder
Builder for IndexSchema
  • Method Details

    • versionField

      IndexSchema.Builder versionField(LongField field)
      Parameters:
      field - the field to be used as the version field
      Returns:
      the builder
    • setFields

      IndexSchema.Builder setFields(Collection<Field> fields)
      Sets the schema fields
      Parameters:
      fields - the schema fields
      Returns:
      the builder
    • addField

      IndexSchema.Builder addField(Field field)
      Adds a field to the schema
      Parameters:
      field - the field to be added to the schema
      Returns:
      the builder
    • addFields

      IndexSchema.Builder addFields(Field... fields)
      Adds multiple fields to the schema
      Parameters:
      fields - the fields to be added to the schema
      Returns:
      the builder
    • addFields

      IndexSchema.Builder addFields(Collection<Field> fields)
      Adds multiple fields to the schema
      Parameters:
      fields - the fields to be added to the schema
      Returns:
      the builder
    • removeField

      IndexSchema.Builder removeField(String fieldName)
      Removes a field from the schema
      Parameters:
      fieldName - the name of the field to be removed. Does nothing if the field is not present
      Returns:
      the builder
    • fieldIsDefined

      boolean fieldIsDefined(String fieldName)
      Checks if a field is defined in the schema
      Parameters:
      fieldName - the name of the field to check
      Returns:
      true if the field is defined, false otherwise
    • addRelation

      IndexSchema.Builder addRelation(String parentDocumentType, String childDocumentType)
      Adds a relation between two document types
      Parameters:
      parentDocumentType - the parent document type
      childDocumentType - the child document type
      Returns:
      the builder
    • addRelations

      IndexSchema.Builder addRelations(String parentDocumentType, Collection<String> childDocumentTypes)
      Adds a relation between a parent document type and multiple child document types
      Parameters:
      parentDocumentType - the parent document type
      childDocumentTypes - the child document types
      Returns:
      the builder
    • setRelations

      IndexSchema.Builder setRelations(Map<String,Collection<String>> relations)
      Sets the relations between document types, replacing any existing relations
      Parameters:
      relations - the relations between document types
      Returns:
      the builder
    • build

      IndexSchema build()
      Builds the schema
      Returns:
      the schema
      Throws:
      FieldAlreadyExistsException - if multiple fields exist with the same name