Class DocumentTypeManager


  • public class DocumentTypeManager
    extends Object
    The DocumentTypeManager keeps track of the document types registered in the Vespa common repository.

    The DocumentTypeManager is also responsible for registering a FieldValue factory for each data type a field can have. The Document object uses this factory to serialize and deserialize the various datatypes. The factory could also be used to expand the functionality of various datatypes, for instance displaying the data type in human-readable form or as XML.

    Author:
    Thomas Gundersen
    • Constructor Detail

      • DocumentTypeManager

        public DocumentTypeManager()
    • Method Detail

      • configure

        @Deprecated
        public DocumentTypeManager configure​(String configId)
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8
        For testing, use fromFile factory method instead
      • hasDataType

        public boolean hasDataType​(String name)
      • hasDataType

        @Deprecated
        public boolean hasDataType​(int code)
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8
      • getDataType

        @Deprecated
        public DataType getDataType​(int code)
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8
      • getDataType

        @Deprecated
        public DataType getDataType​(int code,
                                    String detailedType)
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8
        Return a data type instance
        Parameters:
        code - the code of the data type to return, which must be either built in or present in this manager
        detailedType - detailed type information, or the empty string if none
        Returns:
        the appropriate DataType instance
      • register

        public void register​(DataType type)
        Register a data type of any sort, including document types.
        Parameters:
        type - The datatype to register TODO Give unique ids to document types
      • registerDocumentType

        public DocumentType registerDocumentType​(DocumentType docType)
        Registers a document type. Typically called by someone importing the document types from the common Vespa repository.
        Parameters:
        docType - The document type to register.
        Returns:
        the previously registered type, or null if none was registered
      • getDocumentType

        public DocumentType getDocumentType​(DataTypeName name)
        Gets a registered document.
        Parameters:
        name - the document name of the type
        Returns:
        returns the document type found, or null if there is no type with this name
      • getDocumentType

        public DocumentType getDocumentType​(String name)
        Returns a registered document type
        Parameters:
        name - the type name of the document type
        Returns:
        returns the document type having this name, or null if none
      • createDocument

        public final Document createDocument​(com.yahoo.io.GrowableByteBuffer buf)
      • getDataTypes

        public Collection<DataType> getDataTypes()
        Returns a read only view of the registered data types
        Returns:
        collection of types
      • getDocumentTypes

        public Map<DataTypeName,​DocumentType> getDocumentTypes()
        A read only view of the registered document types
        Returns:
        map of types
      • clear

        @Deprecated
        public void clear()
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8
        Clears the DocumentTypeManager. After this operation, only the default document type and data types are available.
      • shutdown

        @Deprecated
        public void shutdown()
        Deprecated.
        //TODO Will be package-private or removed on Vespa 8