Package com.yahoo.document
Class ReferenceDataType
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.document.DataType
-
- com.yahoo.document.ReferenceDataType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<DataType>
public class ReferenceDataType extends DataType
AReferenceDataType
specifies a particular concrete document type that aReferenceFieldValue
instance binds to.- Author:
- vekterli
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ReferenceDataType(DocumentType targetType, int id)
ReferenceDataType(TemporaryStructuredDataType temporaryTargetType, int id)
Constructor used when building a multi document type model where the concrete instance of the target document type might not yet be known.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DataType rhs)
ReferenceFieldValue
createFieldValue()
Creates a new, empty FieldValue of this typestatic ReferenceDataType
createWithInferredId(DocumentType targetType)
Creates a new type where the numeric ID is based on the hash of targetTypestatic ReferenceDataType
createWithInferredId(TemporaryStructuredDataType targetType)
Creates a new type where the numeric ID is based on the hash of targetTypeboolean
equals(java.lang.Object rhs)
StructuredDataType
getTargetType()
java.lang.Class<? extends ReferenceFieldValue>
getValueClass()
boolean
isValueCompatible(FieldValue value)
void
setTargetType(StructuredDataType targetType)
Overrides the stored temporary data type with a concrete StructuredDataType instance.-
Methods inherited from class com.yahoo.document.DataType
buildFieldPath, clone, createByReflection, createFieldValue, getArray, getCode, getId, getMap, getName, getPrimitiveType, getTensor, getWeightedSet, getWeightedSet, hashCode, isAssignableFrom, isMultivalue, isRegistered, lastPredefinedDataTypeId, register, register, setId, setName, toString, visitMembers
-
-
-
-
Constructor Detail
-
ReferenceDataType
public ReferenceDataType(DocumentType targetType, int id)
-
ReferenceDataType
public ReferenceDataType(TemporaryStructuredDataType temporaryTargetType, int id)
Constructor used when building a multi document type model where the concrete instance of the target document type might not yet be known. The temporary data type should be replaced later using setTargetType().
-
-
Method Detail
-
createWithInferredId
public static ReferenceDataType createWithInferredId(DocumentType targetType)
Creates a new type where the numeric ID is based on the hash of targetType
-
createWithInferredId
public static ReferenceDataType createWithInferredId(TemporaryStructuredDataType targetType)
Creates a new type where the numeric ID is based on the hash of targetType
-
getTargetType
public StructuredDataType getTargetType()
-
setTargetType
public void setTargetType(StructuredDataType targetType)
Overrides the stored temporary data type with a concrete StructuredDataType instance. Should only be invoked from configuration or model code when resolving temporary types.- Throws:
java.lang.IllegalStateException
- if the previously stored target type is already a concrete instance (not TemporaryStructuredDataType).
-
createFieldValue
public ReferenceFieldValue createFieldValue()
Description copied from class:DataType
Creates a new, empty FieldValue of this type- Specified by:
createFieldValue
in classDataType
-
getValueClass
public java.lang.Class<? extends ReferenceFieldValue> getValueClass()
- Specified by:
getValueClass
in classDataType
-
isValueCompatible
public boolean isValueCompatible(FieldValue value)
- Specified by:
isValueCompatible
in classDataType
-
compareTo
public int compareTo(DataType rhs)
-
-