# Document.BuilderProducer

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/annotation/Document.java+class:androidx.appsearch.annotation.Document.BuilderProducer) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
@Documented
@Retention(value = RetentionPolicy.CLASS)
@Target(value = [ElementType.METHOD, ElementType.TYPE])
public annotation Document.BuilderProducer
```

<br />

*** ** * ** ***

Marks a static method or a builder class directly as a builder producer. A builder class should contain a "build()" method to construct the AppSearch document object and setter methods to set field values.

When a static method is marked as a builder producer, the method should return a builder instance for AppSearch to construct the document object. When a builder class is marked as a builder producer directly, AppSearch will use the constructor of the builder class to create a builder instance.

The annotated static method or the constructor of the annotated builder class is allowed to accept parameters to set a part of field values. In this case, AppSearch will only use setters to set values for the remaining fields.

Once a builder producer is specified, AppSearch will be forced to use the builder pattern to construct the document object.