com.google.appengine.api.search

## Class Field.Builder

- java.lang.Object
- - com.google.appengine.api.search.Field.Builder

- Enclosing class:
    Field

      public static final class Field.Builder
      extends java.lang.Object

  A field builder. Fields must have a name, and optionally a locale and at most one of text, html, atom or date.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Field` | `build()` Builds a field using this builder.
    `Field.Builder` | `setAtom(java.lang.String atom)` Sets an atomic value, indivisible text, for the field.
    `Field.Builder` | `setDate(java.util.Date date)` Sets a date associated with the field.
    `Field.Builder` | `setGeoPoint(GeoPoint geoPoint)` Sets a `GeoPoint` value for the field.
    `Field.Builder` | `setHTML(java.lang.String html)` Sets a HTML value for the field.
    `Field.Builder` | `setLocale(java.util.Locale locale)` Sets the Locale of the field value.
    `Field.Builder` | `setName(java.lang.String name)` Sets a name for the field.
    `Field.Builder` | `setNumber(double number)` Sets a numeric value for the field.
    `Field.Builder` | `setText(java.lang.String text)` Sets a text value for the field.
    `Field.Builder` | `setTokenizedPrefix(java.lang.String tokenizedPrefix)` Sets a tokenized prefix value for the field.
    `Field.Builder` | `setUntokenizedPrefix(java.lang.String untokenizedPrefix)` Sets an untokenized prefix value for the field.
    `Field.Builder` | `setVector(java.util.List<java.lang.Double> vector)` Sets a vector value for the field.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### setName

          public Field.Builder setName(java.lang.String name)

      Sets a name for the field. The field name length must be between 1 and FieldChecker#MAXIMUM_NAME_LENGTH and it should match `SearchApiLimits.FIELD_NAME_PATTERN`.
      Parameters:
        `name` - the name of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the name or value is invalid

    - #### setText

          public Field.Builder setText(java.lang.String text)

      Sets a text value for the field.
      Parameters:
        `text` - the text value of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the text is invalid

    - #### setHTML

          public Field.Builder setHTML(java.lang.String html)

      Sets a HTML value for the field.
      Parameters:
        `html` - the HTML value of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the HTML is invalid

    - #### setAtom

          public Field.Builder setAtom(java.lang.String atom)

      Sets an atomic value, indivisible text, for the field.
      Parameters:
        `atom` - the indivisible text of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the atom is invalid

    - #### setDate

          public Field.Builder setDate(java.util.Date date)

      Sets a date associated with the field.
      Parameters:
        `date` - the date of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the date is out of range

    - #### setNumber

          public Field.Builder setNumber(double number)

      Sets a numeric value for the field. The `number` must be between `SearchApiLimits.MINIMUM_NUMBER_VALUE` and `SearchApiLimits.MAXIMUM_NUMBER_VALUE`.
      Parameters:
        `number` - the numeric value of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the number is outside the valid range

    - #### setGeoPoint

          public Field.Builder setGeoPoint(GeoPoint geoPoint)

      Sets a `GeoPoint` value for the field.
      Parameters:
        `geoPoint` - the `GeoPoint` value of the field
      Returns:
        this builder

    - #### setUntokenizedPrefix

          public Field.Builder setUntokenizedPrefix(java.lang.String untokenizedPrefix)

      Sets an untokenized prefix value for the field.
      Parameters:
        `untokenizedPrefix` - the string value of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the untokenized prefix field is invalid

    - #### setTokenizedPrefix

          public Field.Builder setTokenizedPrefix(java.lang.String tokenizedPrefix)

      Sets a tokenized prefix value for the field.
      Parameters:
        `tokenizedPrefix` - the string value of the field
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the tokenized prefix field is invalid

    - #### setVector

          public Field.Builder setVector(java.util.List<java.lang.Double> vector)

      Sets a vector value for the field.
      Parameters:
        `vector` - a list of Double values forming a vector field value
      Returns:
        this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the vector field is invalid

    - #### setLocale

          public Field.Builder setLocale(java.util.Locale locale)

      Sets the Locale of the field value. If none is given, then the locale of the document will be used.
      Parameters:
        `locale` - the locale the field value is written in
      Returns:
        this builder

    - #### build

          public Field build()

      Builds a field using this builder. The field must have a valid name, string value, type.
      Returns:
        a `Field` built by this builder
      Throws:
        `java.lang.IllegalArgumentException` - if the field has an invalid name, text, HTML, atom, date