当前位置: 首页>>代码示例>>Java>>正文


Java GsonFactory类代码示例

本文整理汇总了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;
	
}
 
开发者ID:olami-developers,项目名称:olami-java-client-sdk,代码行数:22,代码来源:APIResponseBuilder.java

示例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);

}
 
开发者ID:olami-developers,项目名称:olami-android-client-sdk,代码行数:30,代码来源:TextInputNLIAnalysisActivity.java


注:本文中的ai.olami.util.GsonFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。