Package com.yahoo.document
Class DocumentTypeManager
- java.lang.Object
-
- com.yahoo.document.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 Summary
Constructors Constructor Description DocumentTypeManager()
DocumentTypeManager(DocumentmanagerConfig config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
assign(DocumentTypeManager other)
void
clear()
Deprecated.//TODO Will be package-private or removed on Vespa 8DocumentTypeManager
configure(String configId)
Deprecated.//TODO Will be package-private or removed on Vespa 8Document
createDocument(DocumentDeserializer data)
Document
createDocument(com.yahoo.io.GrowableByteBuffer buf)
Iterator<DocumentType>
documentTypeIterator()
static DocumentTypeManager
fromFile(String fileName)
Only for unit testsAnnotationTypeRegistry
getAnnotationTypeRegistry()
DataType
getDataType(int code)
Deprecated.//TODO Will be package-private or removed on Vespa 8DataType
getDataType(int code, String detailedType)
Deprecated.//TODO Will be package-private or removed on Vespa 8DataType
getDataType(String name)
Collection<DataType>
getDataTypes()
Returns a read only view of the registered data typesDocumentType
getDocumentType(DataTypeName name)
Gets a registered document.DocumentType
getDocumentType(String name)
Returns a registered document typeMap<DataTypeName,DocumentType>
getDocumentTypes()
A read only view of the registered document typesboolean
hasDataType(int code)
Deprecated.//TODO Will be package-private or removed on Vespa 8boolean
hasDataType(String name)
void
register(DataType type)
Register a data type of any sort, including document types.DocumentType
registerDocumentType(DocumentType docType)
Registers a document type.void
shutdown()
Deprecated.//TODO Will be package-private or removed on Vespa 8
-
-
-
Constructor Detail
-
DocumentTypeManager
public DocumentTypeManager()
-
DocumentTypeManager
@Inject public DocumentTypeManager(DocumentmanagerConfig config)
-
-
Method Detail
-
assign
public void assign(DocumentTypeManager other)
-
configure
@Deprecated public DocumentTypeManager configure(String configId)
Deprecated.//TODO Will be package-private or removed on Vespa 8For testing, use fromFile factory method instead
-
fromFile
public static DocumentTypeManager fromFile(String fileName)
Only for unit tests
-
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 8Return a data type instance- Parameters:
code
- the code of the data type to return, which must be either built in or present in this managerdetailedType
- 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)
-
createDocument
public Document createDocument(DocumentDeserializer data)
-
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
-
documentTypeIterator
public Iterator<DocumentType> documentTypeIterator()
-
clear
@Deprecated public void clear()
Deprecated.//TODO Will be package-private or removed on Vespa 8Clears the DocumentTypeManager. After this operation, only the default document type and data types are available.
-
getAnnotationTypeRegistry
public AnnotationTypeRegistry getAnnotationTypeRegistry()
-
shutdown
@Deprecated public void shutdown()
Deprecated.//TODO Will be package-private or removed on Vespa 8
-
-