public class GenericDocument
extends Object


Represents a document unit.

Documents contain structured data conforming to their AppSearchSchema type. Each document is uniquely identified by a namespace and a String ID within that namespace.

Documents are constructed either by using the GenericDocument.Builder or providing an annotated Document data class.


Nested classes

class GenericDocument.Builder<BuilderType extends Builder>

The builder class for GenericDocument

Protected constructors

GenericDocument(GenericDocument document)

Creates a new GenericDocument from an existing instance.

Public methods

boolean equals(Object other)
static GenericDocument fromDocumentClass(Object document)

Converts an instance of a class annotated with \@Document into an instance of GenericDocument.

long getCreationTimestampMillis()

Returns the creation timestamp of the GenericDocument, in milliseconds.

String getId()

Returns the unique identifier of the GenericDocument.

static int getMaxIndexedProperties()

The maximum number of indexed properties a document can have.

String getNamespace()

Returns the namespace of the GenericDocument.

Object getProperty(String path)

Retrieves the property value with the given path as Object.

boolean getPropertyBoolean(String path)

Retrieves a boolean property by path.

boolean[] getPropertyBooleanArray(String path)

Retrieves a repeated boolean property by path.

byte[] getPropertyBytes(String path)

Retrieves a byte[] property by path.

byte[][] getPropertyBytesArray(String path)

Retrieves a byte[][] property by path.

GenericDocument getPropertyDocument(String path)

Retrieves a GenericDocument property by path.

GenericDocument[] getPropertyDocumentArray(String path)

Retrieves a repeated GenericDocument property by path.

double getPropertyDouble(String path)

Retrieves a double property by path.

double[] getPropertyDoubleArray(String path)

Retrieves a repeated double property by path.

long getPropertyLong(String path)

Retrieves a long property by path.

long[] getPropertyLongArray(String path)

Retrieves a repeated long[] property by path.

Set<String> getPropertyNames()

Returns the names of all properties defined in this document.

String getPropertyString(String path)

Retrieves a String property by path.

String[] getPropertyStringArray(String path)

Retrieves a repeated String property by path.

String getSchemaType()

Returns the AppSearchSchema type of the GenericDocument.

int getScore()

Returns the score of the GenericDocument.

long getTtlMillis()

Returns the TTL (time-to-live) of the GenericDocument, in milliseconds.

int hashCode()
Builder<Builder<?>> toBuilder()

Copies the contents of this GenericDocument into a new GenericDocument.Builder.

<T> T toDocumentClass(Class<T> documentClass)

Converts this GenericDocument into an instance of the provided document class.

String toString()

Inherited methods