Document.DoubleProperty

@Documented
@Retention(value = RetentionPolicy.CLASS)
@Target(value = [ElementType.FIELD, ElementType.METHOD])
public annotation Document.DoubleProperty


Configures a double-precision decimal number field of a class as a property known to AppSearch.

Summary

Nested types

Public methods

abstract String

The name of this property.

abstract boolean

Configures whether this property must be specified for the document to be valid.

abstract Class<Object>

Configures how a property should be converted to and from a Double.

Public methods

name

Added in 1.1.0-alpha04
public abstract String name()

The name of this property. This string is used to query against this property.

If not specified, the name of the field in the code will be used instead.

required

Added in 1.1.0-alpha04
public abstract boolean required()

Configures whether this property must be specified for the document to be valid.

This attribute does not apply to properties of a repeated type (e.g. a list).

Please make sure you understand the consequences of required fields on schema migration before setting this attribute to true.

serializer

public abstract Class<Objectserializer()

Configures how a property should be converted to and from a Double.

Useful for representing properties using rich types that boil down to simple double-precision decimal values in the database.

The referenced class must satisfy the following:

  1. Have a static method called serialize that converts the property's Java type to a Double.
  2. Have a static method called deserialize that converts a Double to the property's Java type or returns null if deserialization failed.

See serializer for an example of a serializer.