Class SDDocumentType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    TemporarySDDocumentType

    public class SDDocumentType
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    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
    See Also:
    Serialized Form
    • Field Detail

    • Constructor Detail

      • SDDocumentType

        public SDDocumentType​(java.lang.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​(java.lang.String name,
                              Search search)
        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
        search - check for type ID collisions in this search definition
    • Method Detail

      • clone

        public SDDocumentType clone()
                             throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.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​(java.lang.String name)
      • getOwnedType

        public SDDocumentType getOwnedType​(com.yahoo.document.DataTypeName name)
      • getType

        public final SDDocumentType getType​(java.lang.String name)
      • addAnnotation

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

        public java.util.Collection<SDDocumentType> getTypes()
        Access to all owned datatypes.
        Returns:
        all types
      • getAnnotations

        public java.util.Collection<com.yahoo.document.annotation.AnnotationType> getAnnotations()
      • findAnnotation

        public com.yahoo.document.annotation.AnnotationType findAnnotation​(java.lang.String name)
      • getAllTypes

        public java.util.Collection<SDDocumentType> getAllTypes()
      • isStruct

        public boolean isStruct()
      • getStruct

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

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

        public java.lang.String getName()
      • getDocumentName

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

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

        public void inherit​(com.yahoo.document.DataTypeName name)
      • getInheritedTypes

        public java.util.Collection<SDDocumentType> getInheritedTypes()
      • validateId

        protected void validateId​(Search search)
      • setFieldId

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

        public com.yahoo.document.Field getField​(java.lang.String name)
        Override getField, as it may need to ask inherited types that isn't registered in document type.
        Parameters:
        name - Name of field to get.
        Returns:
        The field found.
      • addField

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

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

        public com.yahoo.document.Field addField​(java.lang.String string,
                                                 com.yahoo.document.DataType dataType,
                                                 boolean header,
                                                 int code)
      • fieldSet

        public java.util.Set<com.yahoo.document.Field> fieldSet()
      • fieldIterator

        public java.util.Iterator<com.yahoo.document.Field> fieldIterator()
      • getFieldCount

        public int getFieldCount()
      • toString

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

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

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

        public java.util.Optional<DocumentReferences> getDocumentReferences()
      • setDocumentReferences

        public void setDocumentReferences​(DocumentReferences documentReferences)
      • setTemporaryImportedFields

        public void setTemporaryImportedFields​(TemporaryImportedFields temporaryImportedFields)