use of com.amplifyframework.predictions.models.TextFormatType in project amplify-android by aws-amplify.
the class IdentifyTextConfiguration method fromJson.
/**
* Construct an instance of {@link IdentifyTextConfiguration} from
* plugin configuration JSON object.
* @param configurationJson the plugin configuration
* @return the configuration for text identification
* @throws JSONException if identify configuration is malformed
*/
@Nullable
public static IdentifyTextConfiguration fromJson(@NonNull JSONObject configurationJson) throws JSONException {
if (!configurationJson.has(CONFIG_NAME)) {
return null;
}
JSONObject identifyLabelsJson = configurationJson.getJSONObject(CONFIG_NAME);
String formatString = identifyLabelsJson.getString("format");
String networkPolicyString = identifyLabelsJson.getString("defaultNetworkPolicy");
final TextFormatType format = TextFormatType.valueOf(formatString);
final NetworkPolicy networkPolicy = NetworkPolicy.fromKey(networkPolicyString);
return new IdentifyTextConfiguration(format, networkPolicy);
}
Aggregations