Class ProxyDocument

  • All Implemented Interfaces:
    DocumentOperationWrapper, Cloneable, Comparable<com.yahoo.document.datatypes.FieldValue>

    public class ProxyDocument
    extends com.yahoo.document.Document
    implements DocumentOperationWrapper
    This is a facade to a Document, with two purposes:
    • Getters and setters for field data may take into account a schema map of field names.
    • Mapping into struct fields of arbitrary depth using from→mystruct.mystruct.myfield
    This also enforces the @Accesses annotation(s) of the doc proc which uses this.
    Author:
    Vegard Havdal
    • Field Summary

      • Fields inherited from class com.yahoo.document.Document

        classId, SERIALIZED_VERSION
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assign​(Object o)  
      void clear()  
      com.yahoo.document.Document clone()  
      int compareTo​(com.yahoo.document.datatypes.FieldValue fieldValue)  
      void deserialize​(com.yahoo.document.Field field, com.yahoo.document.serialization.FieldReader reader)  
      void deserialize​(com.yahoo.document.serialization.DocumentReader reader)  
      protected void doSetFieldValue​(com.yahoo.document.Field field, com.yahoo.document.datatypes.FieldValue value)  
      boolean equals​(Object o)  
      com.yahoo.document.datatypes.Struct getBody()  
      com.yahoo.document.DocumentType getDataType()  
      com.yahoo.document.Document getDocument()
      The Document which this proxies
      com.yahoo.document.Field getField​(String fieldName)
      note that the returned Field may not be in this Document directly, but may refer to a field in a struct contained in it, in which case the returned Field is only useful for obtaining the field type; it can't be used for get() and set().
      int getFieldCount()  
      com.yahoo.document.datatypes.FieldValue getFieldValue​(com.yahoo.document.Field field)  
      com.yahoo.document.datatypes.FieldValue getFieldValue​(String fieldName)  
      com.yahoo.document.datatypes.Struct getHeader()  
      com.yahoo.document.DocumentId getId()  
      Long getLastModified()  
      int getSerializedSize()  
      com.yahoo.document.DocumentOperation getWrappedDocumentOperation()  
      int hashCode()  
      com.yahoo.document.datatypes.FieldPathIteratorHandler.ModificationStatus iterateNested​(com.yahoo.document.FieldPath fieldPath, int pos, com.yahoo.document.datatypes.FieldPathIteratorHandler handler)  
      Iterator<Map.Entry<com.yahoo.document.Field,​com.yahoo.document.datatypes.FieldValue>> iterator()  
      void onSerialize​(com.yahoo.vespa.objects.Serializer target)  
      void printXml​(com.yahoo.document.serialization.XmlStream xml)  
      com.yahoo.document.datatypes.FieldValue removeFieldValue​(com.yahoo.document.Field field)  
      com.yahoo.document.datatypes.FieldValue removeFieldValue​(String fieldName)  
      void serialize​(com.yahoo.document.Field field, com.yahoo.document.serialization.FieldWriter writer)  
      void serialize​(com.yahoo.document.serialization.DocumentWriter writer)  
      void serialize​(OutputStream out)  
      void setDataType​(com.yahoo.document.DataType type)  
      com.yahoo.document.datatypes.FieldValue setFieldValue​(com.yahoo.document.Field field, com.yahoo.document.datatypes.FieldValue fieldValue)  
      com.yahoo.document.datatypes.FieldValue setFieldValue​(String fieldName, com.yahoo.document.datatypes.FieldValue fieldValue)  
      void setId​(com.yahoo.document.DocumentId id)  
      void setLastModified​(Long lastModified)  
      String toJson()  
      String toString()  
      String toXml()  
      String toXML​(String indent)  
      • Methods inherited from class com.yahoo.document.Document

        createDocument, getApproxSize
      • Methods inherited from class com.yahoo.document.datatypes.StructuredFieldValue

        isGenerated, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue
      • Methods inherited from class com.yahoo.document.datatypes.FieldValue

        create, deserialize, getRecursiveValue, getRecursiveValue, getWrappedValue, onDeserialize, serialize
      • Methods inherited from class com.yahoo.vespa.objects.Identifiable

        create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, onGetClassId, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, visitMembers
      • Methods inherited from class com.yahoo.vespa.objects.Selectable

        select, select, selectMembers
    • Method Detail

      • getField

        public com.yahoo.document.Field getField​(String fieldName)
        note that the returned Field may not be in this Document directly, but may refer to a field in a struct contained in it, in which case the returned Field is only useful for obtaining the field type; it can't be used for get() and set().
        Overrides:
        getField in class com.yahoo.document.Document
      • getFieldValue

        public com.yahoo.document.datatypes.FieldValue getFieldValue​(String fieldName)
        Overrides:
        getFieldValue in class com.yahoo.document.datatypes.StructuredFieldValue
      • getFieldValue

        public com.yahoo.document.datatypes.FieldValue getFieldValue​(com.yahoo.document.Field field)
        Overrides:
        getFieldValue in class com.yahoo.document.Document
      • setFieldValue

        public com.yahoo.document.datatypes.FieldValue setFieldValue​(String fieldName,
                                                                     com.yahoo.document.datatypes.FieldValue fieldValue)
        Overrides:
        setFieldValue in class com.yahoo.document.datatypes.StructuredFieldValue
      • setFieldValue

        public com.yahoo.document.datatypes.FieldValue setFieldValue​(com.yahoo.document.Field field,
                                                                     com.yahoo.document.datatypes.FieldValue fieldValue)
        Overrides:
        setFieldValue in class com.yahoo.document.datatypes.StructuredFieldValue
      • removeFieldValue

        public com.yahoo.document.datatypes.FieldValue removeFieldValue​(String fieldName)
        Overrides:
        removeFieldValue in class com.yahoo.document.datatypes.StructuredFieldValue
      • removeFieldValue

        public com.yahoo.document.datatypes.FieldValue removeFieldValue​(com.yahoo.document.Field field)
        Overrides:
        removeFieldValue in class com.yahoo.document.Document
      • equals

        public boolean equals​(Object o)
        Overrides:
        equals in class com.yahoo.document.Document
      • toString

        public String toString()
        Overrides:
        toString in class com.yahoo.document.Document
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class com.yahoo.document.Document
      • clone

        public com.yahoo.document.Document clone()
        Overrides:
        clone in class com.yahoo.document.Document
      • clear

        public void clear()
        Overrides:
        clear in class com.yahoo.document.Document
      • iterator

        public Iterator<Map.Entry<com.yahoo.document.Field,​com.yahoo.document.datatypes.FieldValue>> iterator()
        Overrides:
        iterator in class com.yahoo.document.Document
      • getId

        public com.yahoo.document.DocumentId getId()
        Overrides:
        getId in class com.yahoo.document.Document
      • setLastModified

        public void setLastModified​(Long lastModified)
        Overrides:
        setLastModified in class com.yahoo.document.Document
      • getLastModified

        public Long getLastModified()
        Overrides:
        getLastModified in class com.yahoo.document.Document
      • setId

        public void setId​(com.yahoo.document.DocumentId id)
        Overrides:
        setId in class com.yahoo.document.Document
      • getHeader

        public com.yahoo.document.datatypes.Struct getHeader()
        Overrides:
        getHeader in class com.yahoo.document.Document
      • getBody

        public com.yahoo.document.datatypes.Struct getBody()
        Overrides:
        getBody in class com.yahoo.document.Document
      • assign

        public void assign​(Object o)
        Overrides:
        assign in class com.yahoo.document.Document
      • setDataType

        public void setDataType​(com.yahoo.document.DataType type)
        Overrides:
        setDataType in class com.yahoo.document.Document
      • getSerializedSize

        public int getSerializedSize()
                              throws com.yahoo.document.serialization.SerializationException
        Overrides:
        getSerializedSize in class com.yahoo.document.Document
        Throws:
        com.yahoo.document.serialization.SerializationException
      • serialize

        public void serialize​(OutputStream out)
                       throws com.yahoo.document.serialization.SerializationException
        Overrides:
        serialize in class com.yahoo.document.Document
        Throws:
        com.yahoo.document.serialization.SerializationException
      • doSetFieldValue

        protected void doSetFieldValue​(com.yahoo.document.Field field,
                                       com.yahoo.document.datatypes.FieldValue value)
        Overrides:
        doSetFieldValue in class com.yahoo.document.Document
      • toXML

        public String toXML​(String indent)
        Overrides:
        toXML in class com.yahoo.document.Document
      • toXml

        public String toXml()
        Overrides:
        toXml in class com.yahoo.document.Document
      • printXml

        public void printXml​(com.yahoo.document.serialization.XmlStream xml)
        Overrides:
        printXml in class com.yahoo.document.Document
      • toJson

        public String toJson()
        Overrides:
        toJson in class com.yahoo.document.Document
      • onSerialize

        public void onSerialize​(com.yahoo.vespa.objects.Serializer target)
                         throws com.yahoo.document.serialization.SerializationException
        Overrides:
        onSerialize in class com.yahoo.document.Document
        Throws:
        com.yahoo.document.serialization.SerializationException
      • getDataType

        public com.yahoo.document.DocumentType getDataType()
        Overrides:
        getDataType in class com.yahoo.document.Document
      • getFieldCount

        public int getFieldCount()
        Overrides:
        getFieldCount in class com.yahoo.document.Document
      • serialize

        public void serialize​(com.yahoo.document.serialization.DocumentWriter writer)
        Overrides:
        serialize in class com.yahoo.document.Document
      • deserialize

        public void deserialize​(com.yahoo.document.serialization.DocumentReader reader)
        Overrides:
        deserialize in class com.yahoo.document.Document
      • serialize

        public void serialize​(com.yahoo.document.Field field,
                              com.yahoo.document.serialization.FieldWriter writer)
        Overrides:
        serialize in class com.yahoo.document.Document
      • deserialize

        public void deserialize​(com.yahoo.document.Field field,
                                com.yahoo.document.serialization.FieldReader reader)
        Overrides:
        deserialize in class com.yahoo.document.Document
      • compareTo

        public int compareTo​(com.yahoo.document.datatypes.FieldValue fieldValue)
        Specified by:
        compareTo in interface Comparable<com.yahoo.document.datatypes.FieldValue>
        Overrides:
        compareTo in class com.yahoo.document.Document
      • iterateNested

        public com.yahoo.document.datatypes.FieldPathIteratorHandler.ModificationStatus iterateNested​(com.yahoo.document.FieldPath fieldPath,
                                                                                                      int pos,
                                                                                                      com.yahoo.document.datatypes.FieldPathIteratorHandler handler)
        Overrides:
        iterateNested in class com.yahoo.document.datatypes.StructuredFieldValue
      • getDocument

        public com.yahoo.document.Document getDocument()
        The Document which this proxies
        Returns:
        The proxied Document