Package com.yahoo.document
Class DocumentTypeManager
java.lang.Object
com.yahoo.document.DocumentTypeManager
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
-
Method Summary
Modifier and TypeMethodDescriptionfinal Document
createDocument
(com.yahoo.io.GrowableByteBuffer buf) static DocumentTypeManager
Only for unit testsReturns a read only view of the registered data typesgetDocumentType
(DataTypeName name) Gets a registered document.getDocumentType
(String name) Returns a registered document typeA read only view of the registered document typesboolean
Returns true if we should ignore attempts to set a field not defined in the document type, rather than (by default) throwing an exception.boolean
hasDocumentType
(String name) Convenience methodvoid
Register a data type of any sort, including document types.registerDocumentType
(DocumentType docType) Registers a document type.void
setIgnoreUndefinedFields
(boolean ignoreUndefinedFields)
-
Constructor Details
-
DocumentTypeManager
public DocumentTypeManager() -
DocumentTypeManager
-
-
Method Details
-
fromFile
Only for unit tests -
getIgnoreUndefinedFields
public boolean getIgnoreUndefinedFields()Returns true if we should ignore attempts to set a field not defined in the document type, rather than (by default) throwing an exception. -
setIgnoreUndefinedFields
public void setIgnoreUndefinedFields(boolean ignoreUndefinedFields) -
register
Register a data type of any sort, including document types.- Parameters:
type
- The datatype to register TODO Give unique ids to document types
-
registerDocumentType
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
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
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
-
hasDocumentType
Convenience method- Parameters:
name
- the name of a document type- Returns:
- returns true if a document type having this name is registered in this manager
-
createDocument
-
createDocument
-
getDataTypes
Returns a read only view of the registered data types- Returns:
- collection of types
-
getDocumentTypes
A read only view of the registered document types- Returns:
- map of types
-
documentTypeIterator
-
getAnnotationTypeRegistry
-