GenericDocument.Builder
public
static
class
GenericDocument.Builder
extends Object
The builder class for GenericDocument.
Summary
Public methods |
GenericDocument
|
build()
Builds the GenericDocument object.
|
BuilderType
|
setCreationTimestampMillis(long creationTimestampMillis)
Sets the creation timestamp of the GenericDocument, in milliseconds.
|
BuilderType
|
setPropertyBoolean(String name, boolean... values)
Sets one or multiple boolean values for a property, replacing its previous
values.
|
BuilderType
|
setPropertyBytes(String name, byte... values)
Sets one or multiple byte[] for a property, replacing its previous values.
|
BuilderType
|
setPropertyDocument(String name, GenericDocument... values)
Sets one or multiple GenericDocument values for a property, replacing its
previous values.
|
BuilderType
|
setPropertyDouble(String name, double... values)
Sets one or multiple double values for a property, replacing its previous values.
|
BuilderType
|
setPropertyLong(String name, long... values)
Sets one or multiple long values for a property, replacing its previous values.
|
BuilderType
|
setPropertyString(String name, String... values)
Sets one or multiple String values for a property, replacing its previous values.
|
BuilderType
|
setScore(int score)
Sets the score of the GenericDocument.
|
BuilderType
|
setTtlMillis(long ttlMillis)
Sets the TTL (time-to-live) of the GenericDocument, in milliseconds.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object.
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
Public constructors
Builder
public Builder (String namespace,
String id,
String schemaType)
Creates a new GenericDocument.Builder.
Once build() is called, the instance can no longer be used.
Document IDs are unique within a namespace.
The number of namespaces per app should be kept small for efficiency reasons.
Public methods
setCreationTimestampMillis
public BuilderType setCreationTimestampMillis (long creationTimestampMillis)
Sets the creation timestamp of the GenericDocument, in milliseconds.
This should be set using a value obtained from the System#currentTimeMillis
time base.
| Parameters |
creationTimestampMillis |
long: a creation timestamp in milliseconds.
Value is a non-negative timestamp measured as the number of
milliseconds since 1970-01-01T00:00:00Z. |
| Returns |
BuilderType |
This value cannot be null. |
setPropertyBoolean
public BuilderType setPropertyBoolean (String name,
boolean... values)
Sets one or multiple boolean values for a property, replacing its previous
values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
boolean: the boolean values of the property.
This value cannot be null. |
| Returns |
BuilderType |
This value cannot be null. |
setPropertyBytes
public BuilderType setPropertyBytes (String name,
byte... values)
Sets one or multiple byte[] for a property, replacing its previous values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
byte: the byte[] of the property.
This value cannot be null. |
setPropertyDocument
public BuilderType setPropertyDocument (String name,
GenericDocument... values)
Sets one or multiple GenericDocument values for a property, replacing its
previous values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
GenericDocument: the GenericDocument values of the property.
This value cannot be null. |
setPropertyDouble
public BuilderType setPropertyDouble (String name,
double... values)
Sets one or multiple double values for a property, replacing its previous values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
double: the double values of the property.
This value cannot be null. |
| Returns |
BuilderType |
This value cannot be null. |
setPropertyLong
public BuilderType setPropertyLong (String name,
long... values)
Sets one or multiple long values for a property, replacing its previous values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
long: the long values of the property.
This value cannot be null. |
| Returns |
BuilderType |
This value cannot be null. |
setPropertyString
public BuilderType setPropertyString (String name,
String... values)
Sets one or multiple String values for a property, replacing its previous values.
| Parameters |
name |
String: the name associated with the values. Must match the name for this
property as given in AppSearchSchema.PropertyConfig#getName.
This value cannot be null. |
values |
String: the String values of the property.
This value cannot be null. |
setScore
public BuilderType setScore (int score)
Sets the score of the GenericDocument.
The score is a query-independent measure of the document's quality, relative to other
GenericDocument objects of the same AppSearchSchema type.
Results may be sorted by score using SearchSpec.Builder#setRankingStrategy.
Documents with higher scores are considered better than documents with lower scores.
Any non-negative integer can be used a score. By default, scores are set to 0.
| Parameters |
score |
int: any non-negative int representing the document's score.
Value is between 0 and Integer.MAX_VALUE inclusive |
| Returns |
BuilderType |
This value cannot be null. |
setTtlMillis
public BuilderType setTtlMillis (long ttlMillis)
Sets the TTL (time-to-live) of the GenericDocument, in milliseconds.
The TTL is measured against GenericDocument.getCreationTimestampMillis(). At the timestamp of
creationTimestampMillis + ttlMillis, measured in the System.currentTimeMillis() time base, the document will be auto-deleted.
The default value is 0, which means the document is permanent and won't be
auto-deleted until the app is uninstalled or AppSearchSession#remove is called.
| Parameters |
ttlMillis |
long: a non-negative duration in milliseconds. |
| Returns |
BuilderType |
This value cannot be null. |