本文整理匯總了Java中ai.olami.util.GsonFactory類的典型用法代碼示例。如果您正苦於以下問題:Java GsonFactory類的具體用法?Java GsonFactory怎麽用?Java GsonFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GsonFactory類屬於ai.olami.util包,在下文中一共展示了GsonFactory類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import ai.olami.util.GsonFactory; //導入依賴的package包/類
/**
* Create API response instance by the specified response JSON string.
*
* @param jsonString - API Response JSON string.
* @return The instance mapped to the specified response JSON string.
*/
public static APIResponse create(String jsonString) {
APIResponse response = null;
try {
response = (APIResponse) GsonFactory.getNormalGson().fromJson(jsonString, APIResponse.class);
response.setJsonStringSource(jsonString);
} catch (Exception e) {
response.setInvalid("Invalid Response Content --> \n" + jsonString + "\n\n" + e.getMessage());
e.printStackTrace();
}
return response;
}
示例2: onCreate
import ai.olami.util.GsonFactory; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_input_word_segmentation);
Intent intent = getIntent();
Config.setLocalizeOption(intent.getIntExtra("LOCALIZE_OPTION", Config.getLocalizeOption()));
textInputSubmitButton = (Button) findViewById(R.id.textSubmitButton);
textInputSubmitButton.setOnClickListener(new textInputSubmitButtonListener());
textInputEdit = (EditText) findViewById(R.id.textInputEditText);
textInputResponse = (TextView) findViewById(R.id.textInputSegAPIResponse);
textInputResponse.setMovementMethod(ScrollingMovementMethod.getInstance());
mJsonDump = GsonFactory.getDebugGson(false);
// * Step 1: Configure your key and localize option.
APIConfiguration config = new APIConfiguration(
Config.getAppKey(), Config.getAppSecret(), Config.getLocalizeOption());
// * Step 2: Create the text recognizer.
mRecognizer = new TextRecognizer(config);
mRecognizer.setSdkType("android");
// * Optional steps: Setup some other configurations.
mRecognizer.setEndUserIdentifier("Someone");
mRecognizer.setTimeout(10000);
}
開發者ID:olami-developers,項目名稱:olami-android-client-sdk,代碼行數:30,代碼來源:TextInputWordSegmentationActivity.java
示例3: onCreate
import ai.olami.util.GsonFactory; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_input_nli_analysis);
Intent intent = getIntent();
Config.setLocalizeOption(intent.getIntExtra("LOCALIZE_OPTION", Config.getLocalizeOption()));
textInputSubmitButton = (Button) findViewById(R.id.textSubmitButton);
textInputSubmitButton.setOnClickListener(new textInputSubmitButtonListener());
textInputEdit = (EditText) findViewById(R.id.textInputEditText);
textInputResponse = (TextView) findViewById(R.id.textInputNLIAPIResponse);
textInputResponse.setMovementMethod(ScrollingMovementMethod.getInstance());
mJsonDump = GsonFactory.getDebugGson(false);
// * Step 1: Configure your key and localize option.
APIConfiguration config = new APIConfiguration(
Config.getAppKey(), Config.getAppSecret(), Config.getLocalizeOption());
// * Step 2: Create the text recognizer.
mRecognizer = new TextRecognizer(config);
mRecognizer.setSdkType("android");
// * Optional steps: Setup some other configurations.
mRecognizer.setEndUserIdentifier("Someone");
mRecognizer.setTimeout(10000);
}