public class DocumentTypeManager extends Object
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.
Modifier and Type | Field and Description |
---|---|
private AnnotationTypeRegistry |
annotationTypeRegistry |
private Map<Integer,DataType> |
dataTypes |
private Map<DataTypeName,DocumentType> |
documentTypes |
private static Logger |
log |
private com.yahoo.config.subscription.ConfigSubscriber |
subscriber |
Constructor and Description |
---|
DocumentTypeManager() |
DocumentTypeManager(com.yahoo.document.config.DocumentmanagerConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
assign(DocumentTypeManager other) |
void |
clear()
Clears the DocumentTypeManager.
|
DocumentTypeManager |
configure(String configId) |
Document |
createDocument(DocumentDeserializer data) |
Document |
createDocument(com.yahoo.io.GrowableByteBuffer buf) |
Document |
createDocument(com.yahoo.io.GrowableByteBuffer header,
com.yahoo.io.GrowableByteBuffer body) |
Iterator<DocumentType> |
documentTypeIterator() |
AnnotationTypeRegistry |
getAnnotationTypeRegistry() |
DataType |
getDataType(int code) |
DataType |
getDataType(int code,
String detailedType)
Return a data type instance
|
DataType |
getDataType(String name) |
(package private) DataType |
getDataTypeAndReturnTemporary(int code,
String detailedType) |
Collection<DataType> |
getDataTypes()
Returns a read only view of the registered data types
|
DocumentType |
getDocumentType(DataTypeName name)
Gets a registered document.
|
DocumentType |
getDocumentType(String name)
Returns a registered document type
|
Map<DataTypeName,DocumentType> |
getDocumentTypes()
A read only view of the registered document types
|
boolean |
hasDataType(int code) |
boolean |
hasDataType(String name) |
void |
register(DataType type)
Register a data type of any sort, including document types.
|
private void |
registerDefaultDataTypes() |
DocumentType |
registerDocumentType(DocumentType docType)
Registers a document type.
|
(package private) void |
registerSingleType(DataType type)
Register a single datatype.
|
private void |
replaceTemporaryTypeInReference(ReferenceDataType referenceDataType) |
(package private) void |
replaceTemporaryTypes() |
private void |
replaceTemporaryTypes(DataType type,
List<DataType> seenStructs) |
private void |
replaceTemporaryTypesInCollection(CollectionDataType collectionDataType,
List<DataType> seenStructs) |
private void |
replaceTemporaryTypesInMap(MapDataType mapDataType,
List<DataType> seenStructs) |
private void |
replaceTemporaryTypesInStruct(StructDataType structDataType,
List<DataType> seenStructs) |
private void |
replaceTemporaryTypesInWeightedSet(WeightedSetDataType weightedSetDataType,
List<DataType> seenStructs) |
void |
shutdown() |
private static final Logger log
private com.yahoo.config.subscription.ConfigSubscriber subscriber
private Map<DataTypeName,DocumentType> documentTypes
private AnnotationTypeRegistry annotationTypeRegistry
public DocumentTypeManager()
@Inject public DocumentTypeManager(com.yahoo.document.config.DocumentmanagerConfig config)
public void assign(DocumentTypeManager other)
public DocumentTypeManager configure(String configId)
private void registerDefaultDataTypes()
public boolean hasDataType(String name)
public boolean hasDataType(int code)
public DataType getDataType(int code)
public DataType getDataType(int code, String detailedType)
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 nonepublic void register(DataType type)
type
- The datatype to register
TODO Give unique ids to document typesvoid registerSingleType(DataType type)
type
- The datatype to registerpublic DocumentType registerDocumentType(DocumentType docType)
docType
- The document type to register.public DocumentType getDocumentType(DataTypeName name)
name
- the document name of the typepublic DocumentType getDocumentType(String name)
name
- the type name of the document typepublic final Document createDocument(com.yahoo.io.GrowableByteBuffer buf)
public Document createDocument(DocumentDeserializer data)
public Document createDocument(com.yahoo.io.GrowableByteBuffer header, com.yahoo.io.GrowableByteBuffer body)
public Collection<DataType> getDataTypes()
public Map<DataTypeName,DocumentType> getDocumentTypes()
public Iterator<DocumentType> documentTypeIterator()
public void clear()
public AnnotationTypeRegistry getAnnotationTypeRegistry()
void replaceTemporaryTypes()
private void replaceTemporaryTypesInStruct(StructDataType structDataType, List<DataType> seenStructs)
private void replaceTemporaryTypeInReference(ReferenceDataType referenceDataType)
private void replaceTemporaryTypesInCollection(CollectionDataType collectionDataType, List<DataType> seenStructs)
private void replaceTemporaryTypesInMap(MapDataType mapDataType, List<DataType> seenStructs)
private void replaceTemporaryTypesInWeightedSet(WeightedSetDataType weightedSetDataType, List<DataType> seenStructs)
public void shutdown()
Copyright © 2017. All rights reserved.