Package com.yahoo.schema.document
Class SDDocumentType
java.lang.Object
com.yahoo.schema.document.SDDocumentType
- All Implemented Interfaces:
Cloneable
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
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSDDocumentType
(com.yahoo.document.DataTypeName name) SDDocumentType
(String name) Creates a new document type.SDDocumentType
(String name, Schema schema) Creates a new document type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotation
(com.yahoo.document.annotation.AnnotationType annotation) com.yahoo.document.Field
addField
(com.yahoo.document.Field field) com.yahoo.document.Field
For adding structs defined in document scopeallTypes()
clone()
Set<com.yahoo.document.Field>
fieldSet()
com.yahoo.document.annotation.AnnotationType
findAnnotation
(String name) com.yahoo.document.DataTypeName
com.yahoo.document.DocumentType
com.yahoo.document.Field
Override getField, as it may need to ask inherited types that isn't registered in document type.int
Returns the number of fields in this only, not including inherited fieldsThe field sets defined for this type and itsSchema
getName()
final SDDocumentType
getOwnedType
(String name) com.yahoo.document.DataType
getType
(NewDocumentType.Name name) final SDDocumentType
getTypes()
Returns all owned datatypes.void
inherit
(SDDocumentType type) Map<com.yahoo.document.DataTypeName,
SDDocumentType> boolean
isStruct()
void
setDocumentReferences
(DocumentReferences documentReferences) void
setFieldId
(SDField field, int id) void
setFieldSets
(FieldSets fieldSets) Sets the field sets for thissetStruct
(com.yahoo.document.DataType structType) void
setTemporaryImportedFields
(TemporaryImportedFields temporaryImportedFields) toString()
protected void
validateId
(Schema schema)
-
Field Details
-
VESPA_DOCUMENT
-
-
Constructor Details
-
SDDocumentType
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
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 typeschema
- check for type ID collisions in this search definition
-
-
Method Details
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
addType
For adding structs defined in document scope- Parameters:
dt
- the struct to add- Returns:
- self, for chaining
-
getOwnedType
-
getOwnedType
-
getType
-
getType
-
addAnnotation
public void addAnnotation(com.yahoo.document.annotation.AnnotationType annotation) -
getTypes
Returns all owned datatypes. -
getAnnotations
-
findAnnotation
-
allTypes
-
isStruct
public boolean isStruct() -
getStruct
public com.yahoo.document.DataType getStruct() -
setStruct
-
getName
-
getDocumentName
public com.yahoo.document.DataTypeName getDocumentName() -
getDocumentType
public com.yahoo.document.DocumentType getDocumentType() -
inherit
-
getInheritedTypes
-
inheritedTypes
-
validateId
-
setFieldId
-
getField
Override getField, as it may need to ask inherited types that isn't registered in document type. -
addField
public com.yahoo.document.Field addField(com.yahoo.document.Field field) -
addField
-
addField
public com.yahoo.document.Field addField(String fName, com.yahoo.document.DataType dataType, int code) -
fieldSet
-
getFieldCount
public int getFieldCount()Returns the number of fields in this only, not including inherited fields -
toString
-
getFieldSets
The field sets defined for this type and itsSchema
-
setFieldSets
Sets the field sets for this -
getDocumentReferences
-
setDocumentReferences
-
getTemporaryImportedFields
-
setTemporaryImportedFields
-