Class SDDocumentType

java.lang.Object
com.yahoo.schema.document.SDDocumentType
All Implemented Interfaces:
Cloneable

public class SDDocumentType extends Object implements Cloneable
A document definition is a list of fields. Documents may inherit other documents, implicitly acquiring their fields as it's own. If a document is not set to inherit any document, it will always inherit the document "document.0".
Author:
Thomas Gundersen, bratseth
  • Field Details

  • Constructor Details

    • SDDocumentType

      public SDDocumentType(String name)
      Creates a new document type. The document type id will be generated as a hash from the document type name.
      Parameters:
      name - The name of the new document type
    • SDDocumentType

      public SDDocumentType(com.yahoo.document.DataTypeName name)
    • SDDocumentType

      public SDDocumentType(String name, Schema schema)
      Creates a new document type. The document type id will be generated as a hash from the document type name.
      Parameters:
      name - the name of the new document type
      schema - check for type ID collisions in this search definition
  • Method Details

    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • addType

      public SDDocumentType addType(SDDocumentType dt)
      For adding structs defined in document scope
      Parameters:
      dt - the struct to add
      Returns:
      self, for chaining
    • getOwnedType

      public final SDDocumentType getOwnedType(String name)
    • getOwnedType

      public SDDocumentType getOwnedType(NewDocumentType.Name name)
    • getType

      public final SDDocumentType getType(String name)
    • getType

      public SDDocumentType getType(NewDocumentType.Name name)
    • addAnnotation

      public void addAnnotation(com.yahoo.document.annotation.AnnotationType annotation)
    • getTypes

      public Collection<SDDocumentType> getTypes()
      Returns all owned datatypes.
    • getAnnotations

      public Map<String,com.yahoo.document.annotation.AnnotationType> getAnnotations()
    • findAnnotation

      public com.yahoo.document.annotation.AnnotationType findAnnotation(String name)
    • allTypes

    • isStruct

      public boolean isStruct()
    • getStruct

      public com.yahoo.document.DataType getStruct()
    • setStruct

      public SDDocumentType setStruct(com.yahoo.document.DataType structType)
    • getName

      public String getName()
    • getDocumentName

      public com.yahoo.document.DataTypeName getDocumentName()
    • getDocumentType

      public com.yahoo.document.DocumentType getDocumentType()
    • inherit

      public void inherit(SDDocumentType type)
    • getInheritedTypes

      public Collection<SDDocumentType> getInheritedTypes()
    • inheritedTypes

      public Map<com.yahoo.document.DataTypeName,SDDocumentType> inheritedTypes()
    • validateId

      protected void validateId(Schema schema)
    • setFieldId

      public void setFieldId(SDField field, int id)
    • getField

      public com.yahoo.document.Field getField(String name)
      Override getField, as it may need to ask inherited types that isn't registered in document type.
    • addField

      public void addField(com.yahoo.document.Field field)
    • addField

      public SDField addField(String string, com.yahoo.document.DataType dataType)
    • addField

      public com.yahoo.document.Field addField(String fName, com.yahoo.document.DataType dataType, int code)
    • fieldSet

      public Set<com.yahoo.document.Field> fieldSet()
    • getFieldCount

      public int getFieldCount()
      Returns the number of fields in this only, not including inherited fields
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFieldSets

      public FieldSets getFieldSets()
      The field sets defined for this type and its Schema
    • setFieldSets

      public void setFieldSets(FieldSets fieldSets)
      Sets the field sets for this
    • getDocumentReferences

      public Optional<DocumentReferences> getDocumentReferences()
    • setDocumentReferences

      public void setDocumentReferences(DocumentReferences documentReferences)
    • getTemporaryImportedFields

      public TemporaryImportedFields getTemporaryImportedFields()
    • setTemporaryImportedFields

      public void setTemporaryImportedFields(TemporaryImportedFields temporaryImportedFields)