# TypedCandidate


```
public final class TypedCandidate<T extends Object>
```

<br />

*** ** * ** ***

A piece of a response from the model. Contains the FinishReason in addition to the response object of the desired class type.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/annotation/IntDef.html(value = [0, 1, -100]) public annotation https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate.TypedFinishReason` The reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate` is returned. |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/java/lang/Integer.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate#getFinishReason()()` the reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate` is finished generating. |
| `final T` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate#getResponse()()` the response object of the desired class type. |

## Public methods

### getFinishReason

```
public final Integer getFinishReason()
```

the reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/TypedCandidate` is finished generating.

### getResponse

```
public final T getResponse()
```

the response object of the desired class type. This is null if the response cannot be parsed to the desired class.