Package com.yahoo.docproc.proxy
Class ProxyDocument
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.document.datatypes.FieldValue
-
- com.yahoo.document.datatypes.CompositeFieldValue
-
- com.yahoo.document.datatypes.StructuredFieldValue
-
- com.yahoo.document.Document
-
- com.yahoo.docproc.proxy.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
- Author:
- Vegard Havdal
-
-
Constructor Summary
Constructors Constructor Description ProxyDocument(DocumentProcessor docProc, com.yahoo.document.Document doc, Map<String,String> fieldMap)
-
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()
TheDocument
which this proxiescom.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.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
-
-
-
-
Constructor Detail
-
ProxyDocument
public ProxyDocument(DocumentProcessor docProc, com.yahoo.document.Document doc, Map<String,String> fieldMap)
-
-
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 classcom.yahoo.document.Document
-
getFieldValue
public com.yahoo.document.datatypes.FieldValue getFieldValue(String fieldName)
- Overrides:
getFieldValue
in classcom.yahoo.document.datatypes.StructuredFieldValue
-
getFieldValue
public com.yahoo.document.datatypes.FieldValue getFieldValue(com.yahoo.document.Field field)
- Overrides:
getFieldValue
in classcom.yahoo.document.Document
-
setFieldValue
public com.yahoo.document.datatypes.FieldValue setFieldValue(String fieldName, com.yahoo.document.datatypes.FieldValue fieldValue)
- Overrides:
setFieldValue
in classcom.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 classcom.yahoo.document.datatypes.StructuredFieldValue
-
removeFieldValue
public com.yahoo.document.datatypes.FieldValue removeFieldValue(String fieldName)
- Overrides:
removeFieldValue
in classcom.yahoo.document.datatypes.StructuredFieldValue
-
removeFieldValue
public com.yahoo.document.datatypes.FieldValue removeFieldValue(com.yahoo.document.Field field)
- Overrides:
removeFieldValue
in classcom.yahoo.document.Document
-
getWrappedDocumentOperation
public com.yahoo.document.DocumentOperation getWrappedDocumentOperation()
- Specified by:
getWrappedDocumentOperation
in interfaceDocumentOperationWrapper
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classcom.yahoo.document.Document
-
toString
public String toString()
- Overrides:
toString
in classcom.yahoo.document.Document
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.yahoo.document.Document
-
clone
public com.yahoo.document.Document clone()
- Overrides:
clone
in classcom.yahoo.document.Document
-
clear
public void clear()
- Overrides:
clear
in classcom.yahoo.document.Document
-
iterator
public Iterator<Map.Entry<com.yahoo.document.Field,com.yahoo.document.datatypes.FieldValue>> iterator()
- Overrides:
iterator
in classcom.yahoo.document.Document
-
getId
public com.yahoo.document.DocumentId getId()
- Overrides:
getId
in classcom.yahoo.document.Document
-
setLastModified
public void setLastModified(Long lastModified)
- Overrides:
setLastModified
in classcom.yahoo.document.Document
-
getLastModified
public Long getLastModified()
- Overrides:
getLastModified
in classcom.yahoo.document.Document
-
setId
public void setId(com.yahoo.document.DocumentId id)
- Overrides:
setId
in classcom.yahoo.document.Document
-
getHeader
public com.yahoo.document.datatypes.Struct getHeader()
- Overrides:
getHeader
in classcom.yahoo.document.Document
-
getBody
public com.yahoo.document.datatypes.Struct getBody()
- Overrides:
getBody
in classcom.yahoo.document.Document
-
assign
public void assign(Object o)
- Overrides:
assign
in classcom.yahoo.document.Document
-
setDataType
public void setDataType(com.yahoo.document.DataType type)
- Overrides:
setDataType
in classcom.yahoo.document.Document
-
getSerializedSize
public int getSerializedSize() throws com.yahoo.document.serialization.SerializationException
- Overrides:
getSerializedSize
in classcom.yahoo.document.Document
- Throws:
com.yahoo.document.serialization.SerializationException
-
serialize
public void serialize(OutputStream out) throws com.yahoo.document.serialization.SerializationException
- Overrides:
serialize
in classcom.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 classcom.yahoo.document.Document
-
toXml
public String toXml()
- Overrides:
toXml
in classcom.yahoo.document.Document
-
printXml
public void printXml(com.yahoo.document.serialization.XmlStream xml)
- Overrides:
printXml
in classcom.yahoo.document.Document
-
toJson
public String toJson()
- Overrides:
toJson
in classcom.yahoo.document.Document
-
onSerialize
public void onSerialize(com.yahoo.vespa.objects.Serializer target) throws com.yahoo.document.serialization.SerializationException
- Overrides:
onSerialize
in classcom.yahoo.document.Document
- Throws:
com.yahoo.document.serialization.SerializationException
-
getDataType
public com.yahoo.document.DocumentType getDataType()
- Overrides:
getDataType
in classcom.yahoo.document.Document
-
getFieldCount
public int getFieldCount()
- Overrides:
getFieldCount
in classcom.yahoo.document.Document
-
serialize
public void serialize(com.yahoo.document.serialization.DocumentWriter writer)
- Overrides:
serialize
in classcom.yahoo.document.Document
-
deserialize
public void deserialize(com.yahoo.document.serialization.DocumentReader reader)
- Overrides:
deserialize
in classcom.yahoo.document.Document
-
serialize
public void serialize(com.yahoo.document.Field field, com.yahoo.document.serialization.FieldWriter writer)
- Overrides:
serialize
in classcom.yahoo.document.Document
-
deserialize
public void deserialize(com.yahoo.document.Field field, com.yahoo.document.serialization.FieldReader reader)
- Overrides:
deserialize
in classcom.yahoo.document.Document
-
compareTo
public int compareTo(com.yahoo.document.datatypes.FieldValue fieldValue)
- Specified by:
compareTo
in interfaceComparable<com.yahoo.document.datatypes.FieldValue>
- Overrides:
compareTo
in classcom.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 classcom.yahoo.document.datatypes.StructuredFieldValue
-
getDocument
public com.yahoo.document.Document getDocument()
TheDocument
which this proxies- Returns:
- The proxied Document
-
-