Interface DocumentElement
-
- All Known Implementing Classes:
NoOpDocumentElement
public interface DocumentElementAn element of a document.Instances may represent the document root as well as a partial view of the document, for instance a view on a specific "object" field nested inside the document.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddNullObject(String relativeFieldName)Add anullobject to a field in this document element.voidaddNullObject(IndexObjectFieldReference fieldReference)Add anullobject to the referenced field in this document element.DocumentElementaddObject(String relativeFieldName)Add a new object to a field in this document element.DocumentElementaddObject(IndexObjectFieldReference fieldReference)Add a new object to a field in this document element.voidaddValue(String relativeFieldName, Object value)Add a new value to a field in this document element.<F> voidaddValue(IndexFieldReference<F> fieldReference, F value)Add a new value to a field in this document element.
-
-
-
Method Detail
-
addValue
<F> void addValue(IndexFieldReference<F> fieldReference, F value)
Add a new value to a field in this document element.This method can be called multiple times for the same field, which will result in multiple values being added to the same field.
- Type Parameters:
F- The type of values for the given field.- Parameters:
fieldReference- A reference to the field to add a value to. References are returned byIndexSchemaFieldFinalStep.toReference()in thefield definition DSL.value- The value to add to the field.- Throws:
SearchException- If the field is defined in a different document element.
-
addObject
DocumentElement addObject(IndexObjectFieldReference fieldReference)
Add a new object to a field in this document element.- Parameters:
fieldReference- A reference to the object field to add an object to. References are returned byIndexSchemaFieldFinalStep.toReference()in thefield definition DSL.- Returns:
- The new object, that can be populated with its own fields.
- Throws:
SearchException- If the field is defined in a different document element.
-
addNullObject
void addNullObject(IndexObjectFieldReference fieldReference)
Add anullobject to the referenced field in this document element.The
nullobject may have a representation in the backend (such as a JSONnull), or it may be ignored completely, depending on the backend implementation.- Parameters:
fieldReference- A reference to the object field to add anullobject to. References are returned byIndexSchemaFieldFinalStep.toReference()in thefield definition DSL.- Throws:
SearchException- If the field is defined in a different document element.
-
addValue
void addValue(String relativeFieldName, Object value)
Add a new value to a field in this document element.This method can be called multiple times for the same field, which will result in multiple values being added to the same field.
- Parameters:
relativeFieldName- The name of the field to add a value to, relative to this document element. The field must have been defined previously, either directly throughIndexSchemaElement.field(String, Function), or indirectly throughIndexSchemaElement.fieldTemplate(String, Function).value- The value to add to the field.- Throws:
SearchException- If the field is not defined or ifvaluehas an incorrect type of this field.
-
addObject
DocumentElement addObject(String relativeFieldName)
Add a new object to a field in this document element.- Parameters:
relativeFieldName- The name of the object field to add a value to, relative to this document element. The field must have been defined previously, either directly throughIndexSchemaElement.objectField(String, ObjectStructure), or indirectly throughIndexSchemaElement.objectFieldTemplate(String, ObjectStructure).- Returns:
- The new object, that can be populated with its own fields.
- Throws:
SearchException- If the field is not defined or is not an object field.
-
addNullObject
void addNullObject(String relativeFieldName)
Add anullobject to a field in this document element.The
nullobject may have a representation in the backend (such as a JSONnull), or it may be ignored completely, depending on the backend implementation.- Parameters:
relativeFieldName- The name of the object field to add a value to, relative to this document element. The field must have been defined previously, either directly throughIndexSchemaElement.objectField(String, ObjectStructure), or indirectly throughIndexSchemaElement.objectFieldTemplate(String, ObjectStructure).- Throws:
SearchException- If the field is not defined or is not an object field.
-
-