# A2uiMessageParser

Artifact: [androidx.a2ui:a2ui-model](https://developer.android.com/jetpack/androidx/releases/a2ui) [View Source](https://cs.android.com/search?q=file:androidx/a2ui/model/processor/A2uiMessageParser.kt+class:androidx.a2ui.model.processor.A2uiMessageParser) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

*** ** * ** ***


```
public fun interface A2uiMessageParser<T extends Object>
```

<br />

Known direct subclasses [A2uiJsonMessageParser](https://developer.android.com/reference/androidx/a2ui/model/processor/A2uiJsonMessageParser)

|---|---|
| `https://developer.android.com/reference/androidx/a2ui/model/processor/A2uiJsonMessageParser` | Parses JSON strings into `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiServerToClientMessage` protocol messages. |

*** ** * ** ***

Parses raw input into `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiServerToClientMessage` protocol messages.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | the type of input to parse |

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiServerToClientMessage` | `https://developer.android.com/reference/androidx/a2ui/model/processor/A2uiMessageParser#parse(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull T input)` Parses the `https://developer.android.com/reference/androidx/a2ui/model/processor/A2uiMessageParser#parse(kotlin.Any)` into an `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiServerToClientMessage`. |

## Public methods

### parse

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
abstract @NonNull A2uiServerToClientMessage parse(@NonNull T input)
```

Parses the `https://developer.android.com/reference/androidx/a2ui/model/processor/A2uiMessageParser#parse(kotlin.Any)` into an `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiServerToClientMessage`.

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiException.A2uiValidationException` | if the input is malformed or invalid |