Package io.milvus.param.collection

## Class FieldType.Builder

- java.lang.Object
- - io.milvus.param.collection.FieldType.Builder

- Enclosing class:
    FieldType

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

  Builder for `FieldType` class.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FieldType.Builder` | `addTypeParam​(@NonNull java.lang.String key, @NonNull java.lang.String value)` | Adds a parameter pair for the field.
    `FieldType` | `build()` | Verifies parameters and creates a new `FieldType` instance.
    `FieldType.Builder` | `withAutoID​(boolean autoID)` | Enables auto-id function for the field.
    `FieldType.Builder` | `withDataType​(@NonNull io.milvus.grpc.DataType dataType)` | Sets the data type for the field.
    `FieldType.Builder` | `withDescription​(@NonNull java.lang.String description)` | Sets the field description.
    `FieldType.Builder` | `withDimension​(@NonNull java.lang.Integer dimension)` | Sets the dimension of a vector field.
    `FieldType.Builder` | `withElementType​(@NonNull io.milvus.grpc.DataType elementType)` | Sets the element type for Array type field.
    `FieldType.Builder` | `withIsDynamic​(boolean isDynamic)` | Sets the isDynamic of a field.
    `FieldType.Builder` | `withMaxCapacity​(@NonNull java.lang.Integer maxCapacity)` | Sets the max capacity of an array field.
    `FieldType.Builder` | `withMaxLength​(@NonNull java.lang.Integer maxLength)` | Sets the max length of a varchar field.
    `FieldType.Builder` | `withName​(@NonNull java.lang.String name)` |
    `FieldType.Builder` | `withPartitionKey​(boolean partitionKey)` | Sets the field to be partition key.
    `FieldType.Builder` | `withPrimaryKey​(boolean primaryKey)` | Sets the field as the primary key field.
    `FieldType.Builder` | `withTypeParams​(@NonNull java.util.Map<java.lang.String,​java.lang.String> typeParams)` | Sets more parameters for the field.

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

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

- - ### Method Detail

    - #### withName

          public FieldType.Builder withName​(@NonNull
                                            @NonNull java.lang.String name)

    - #### withIsDynamic

          public FieldType.Builder withIsDynamic​(boolean isDynamic)

      Sets the isDynamic of a field.
      Parameters:
        `isDynamic` - of a field
      Returns:
        `Builder`

    - #### withPrimaryKey

          public FieldType.Builder withPrimaryKey​(boolean primaryKey)

      Sets the field as the primary key field. Note that the current release of Milvus only support `Long` data type as primary key.
      Parameters:
        `primaryKey` - true is primary key, false is not
      Returns:
        `Builder`

    - #### withDescription

          public FieldType.Builder withDescription​(@NonNull
                                                   @NonNull java.lang.String description)

      Sets the field description. The description can be empty. The default is "".
      Parameters:
        `description` - description of the field
      Returns:
        `Builder`

    - #### withDataType

          public FieldType.Builder withDataType​(@NonNull
                                                @NonNull io.milvus.grpc.DataType dataType)

      Sets the data type for the field.
      Parameters:
        `dataType` - data type of the field
      Returns:
        `Builder`

    - #### withElementType

          public FieldType.Builder withElementType​(@NonNull
                                                   @NonNull io.milvus.grpc.DataType elementType)

      Sets the element type for Array type field.
      Parameters:
        `elementType` - element type of the Array type field
      Returns:
        `Builder`

    - #### addTypeParam

          public FieldType.Builder addTypeParam​(@NonNull
                                                @NonNull java.lang.String key,
                                                @NonNull
                                                @NonNull java.lang.String value)

      Adds a parameter pair for the field.
      Parameters:
        `key` - parameter key
        `value` - parameter value
      Returns:
        `Builder`

    - #### withTypeParams

          public FieldType.Builder withTypeParams​(@NonNull
                                                  @NonNull java.util.Map<java.lang.String,​java.lang.String> typeParams)

      Sets more parameters for the field.
      Parameters:
        `typeParams` - parameters of the field
      Returns:
        `Builder`

    - #### withDimension

          public FieldType.Builder withDimension​(@NonNull
                                                 @NonNull java.lang.Integer dimension)

      Sets the dimension of a vector field. Dimension value must be greater than zero.
      Parameters:
        `dimension` - dimension of the field
      Returns:
        `Builder`

    - #### withMaxLength

          public FieldType.Builder withMaxLength​(@NonNull
                                                 @NonNull java.lang.Integer maxLength)

      Sets the max length of a varchar field. The value must be greater than zero.
      Parameters:
        `maxLength` - max length of a varchar field
      Returns:
        `Builder`

    - #### withMaxCapacity

          public FieldType.Builder withMaxCapacity​(@NonNull
                                                   @NonNull java.lang.Integer maxCapacity)

      Sets the max capacity of an array field. The value must be greater than zero. The valid capacity value range is [1, 4096]
      Parameters:
        `maxCapacity` - max capacity of an array field
      Returns:
        `Builder`

    - #### withAutoID

          public FieldType.Builder withAutoID​(boolean autoID)

      Enables auto-id function for the field. Note that the auto-id function can only be enabled on primary key field. If auto-id function is enabled, Milvus will automatically generate unique ID for each entity, thus you do not need to provide values for the primary key field when inserting. If auto-id is disabled, you need to provide values for the primary key field when inserting.
      Parameters:
        `autoID` - true enable auto-id, false disable auto-id
      Returns:
        `Builder`

    - #### withPartitionKey

          public FieldType.Builder withPartitionKey​(boolean partitionKey)

      Sets the field to be partition key. A partition key field's values are hashed and distributed to different logic partitions. Only int64 and varchar type field can be partition key. Primary key field cannot be partition key.
      Parameters:
        `partitionKey` - true is partition key, false is not
      Returns:
        `Builder`

    - #### build

          public FieldType build()
                          throws ParamException

      Verifies parameters and creates a new `FieldType` instance.
      Returns:
        `FieldType`
      Throws:
        `ParamException`