Class DataType

    • Constructor Detail

      • DataType

        protected DataType​(String name,
                           int dataTypeId)
        Creates a datatype
        Parameters:
        name - the name of the type
        dataTypeId - the id of the type
    • Method Detail

      • lastPredefinedDataTypeId

        public static int lastPredefinedDataTypeId()
      • clone

        public DataType clone()
        Overrides:
        clone in class com.yahoo.vespa.objects.Identifiable
      • isRegistered

        public boolean isRegistered()
      • createFieldValue

        public abstract FieldValue createFieldValue()
        Creates a new, empty FieldValue of this type
      • createByReflection

        protected FieldValue createByReflection​(Object arg)
        Creates a field value by reflection
        Parameters:
        arg - the value of the newly created field value
        Returns:
        a fully constructed value
      • createFieldValue

        public FieldValue createFieldValue​(Object arg)
        Creates a new FieldValue of this type, with the given value.
        Parameters:
        arg - the value of the new FieldValue
        Returns:
        a new FieldValue of this type, with the given value
      • getValueClass

        public abstract Class getValueClass()
      • isValueCompatible

        public abstract boolean isValueCompatible​(FieldValue value)
      • isAssignableFrom

        public final boolean isAssignableFrom​(DataType dataType)
      • getArray

        public static ArrayDataType getArray​(DataType type)
        Returns an array datatype, where the array elements are of the given type
        Parameters:
        type - the type to create an array of
        Returns:
        the array data type
      • getMap

        public static MapDataType getMap​(DataType key,
                                         DataType value)
        Returns a map datatype
        Parameters:
        key - the key type
        value - the value type
        Returns:
        the map data type
      • getWeightedSet

        public static WeightedSetDataType getWeightedSet​(DataType type)
        Returns a weighted set datatype, where the elements are of the given type
        Parameters:
        type - the type to create a weighted set of
        Returns:
        the weighted set data type
      • getWeightedSet

        public static WeightedSetDataType getWeightedSet​(DataType type,
                                                         boolean createIfNonExistent,
                                                         boolean removeIfZero)
        Returns a weighted set datatype, where the elements are of the given type, and which supports the properties createIfNonExistent and removeIfZero
        Parameters:
        type - the type to create a weighted set of
        createIfNonExistent - whether the type has createIfNonExistent
        removeIfZero - whether the type has removeIfZero
        Returns:
        the weighted set data type
      • getTensor

        public static TensorDataType getTensor​(com.yahoo.tensor.TensorType type)
        Returns the given tensor type as a DataType
      • getName

        public String getName()
      • setName

        protected void setName​(String name)
        Sets the name of this data type. WARNING! Do not use!
        Parameters:
        name - the name of this data type.
      • getId

        public int getId()
      • setId

        public void setId​(int id)
        Sets the ID of this data type. WARNING! Do not use!
        Parameters:
        id - the ID of this data type.
      • register

        public final void register​(DocumentTypeManager manager)
        Registers this type in the given document manager.
        Parameters:
        manager - the DocumentTypeManager to register in.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class com.yahoo.vespa.objects.Identifiable
      • equals

        public boolean equals​(Object other)
        Overrides:
        equals in class com.yahoo.vespa.objects.Identifiable
      • toString

        public String toString()
        Overrides:
        toString in class com.yahoo.vespa.objects.Identifiable
      • getCode

        public int getCode()
      • buildFieldPath

        public FieldPath buildFieldPath​(String fieldPathString)
        Creates a field path from the given field path string.
        Parameters:
        fieldPathString - a string containing the field path
        Returns:
        Returns a valid field path, parsed from the string
      • getPrimitiveType

        public PrimitiveDataType getPrimitiveType()
        Returns the primitive datatype associated with this datatype, i.e. the type itself if this is a PrimitiveDataType, the nested type if this is a CollectionDataType or null for all other cases
        Returns:
        primitive data type, or null
      • visitMembers

        public void visitMembers​(com.yahoo.vespa.objects.ObjectVisitor visitor)
        Overrides:
        visitMembers in class com.yahoo.vespa.objects.Identifiable
      • isMultivalue

        public boolean isMultivalue()
        Returns whether this is a multivalue type, i.e either a CollectionDataType or a MapDataType