本文整理汇总了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);
}