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


Java GsonSerializer类代码示例

本文整理汇总了Java中com.microsoft.services.orc.serialization.impl.GsonSerializer的典型用法代码示例。如果您正苦于以下问题:Java GsonSerializer类的具体用法?Java GsonSerializer怎么用?Java GsonSerializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GsonSerializer类属于com.microsoft.services.orc.serialization.impl包,在下文中一共展示了GsonSerializer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GetExclusions

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
private Map<String, Map<String, String>> GetExclusions(InputStream inputStream){
    Map<String, Map<String, String>> exclusions = new HashMap<>();
    try {
        BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
        StringBuilder total = new StringBuilder();
        String line;
        while ((line = r.readLine()) != null) {
            total.append(line);
        }

        GsonSerializer serializer = new GsonSerializer();
        exclusions = serializer.deserialize(total.toString(), exclusions.getClass());

        return exclusions;
    }catch (Throwable t){
        //log
        return exclusions;
    }
}
 
开发者ID:OfficeDev,项目名称:Microsoft-Graph-SDK-Android,代码行数:20,代码来源:MainActivity.java

示例2: getDependencyResolver

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
private static DependencyResolver getDependencyResolver(final String token) {

        return new DependencyResolver.Builder(
                new OkHttpTransport(), new GsonSerializer(),
                new AuthenticationCredentials() {
                    @Override
                    public Credentials getCredentials() {
                        return new OAuthCredentials(token);
                    }
                }).build();
    }
 
开发者ID:OfficeDev,项目名称:Microsoft-Graph-SDK-Android,代码行数:12,代码来源:ApplicationContext.java

示例3: testGetAndUpdateNestedEntity

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
@Test
public void testGetAndUpdateNestedEntity() throws ExecutionException, InterruptedException {
    //getSampleEntity.json
    //updateSampleEntityPATCH.json

    String payload = new GsonSerializer().serialize(getSampleEntity());
    resolver.getLogger().log("EntityPayload: " + payload, LogLevel.ERROR);
    //Get Entity
    SampleEntity result = null;
    SampleEntity updateResponse = null;
    try {
        result = client.getMe()
                .addHeader("WithNested", "no")
                .read()
                .get();

        SampleEntity nestedEntity = getSampleEntity();
        result.setNestedSampleEntity(nestedEntity);

        updateResponse = client.getMe()
                .addHeader("UpdateNested", "no")
                .update(result).get();

    } catch (Throwable t) {
        resolver.getLogger().log(t.getLocalizedMessage(), LogLevel.ERROR);
    }

    assertThat(result, is(notNullValue()));
    assertThat(updateResponse, is(notNullValue()));
}
 
开发者ID:OfficeDev,项目名称:orc-for-android,代码行数:31,代码来源:SampleServiceTests.java

示例4: onOptionsItemSelected

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case R.id.menu_settings:
		startActivity(new Intent(this, OfficePreferenceActivity.class));
		return true;

	case R.id.menu_run_tests:
		if (ApplicationContext.getGraphEndpointUrl().trim().equals("")) {
			startActivity(new Intent(this, OfficePreferenceActivity.class));
		} else {
               mCurrentTestRun = new ArrayList<>();
			runTests();
		}
		return true;

	case R.id.menu_check_all:
		changeCheckAllTests(true);
		return true;

	case R.id.menu_uncheck_all:
		changeCheckAllTests(false);
		return true;

	case R.id.menu_reset:
		refreshTestGroupsAndLog();
		return true;

	case R.id.menu_view_log:
           GsonSerializer serializer = new GsonSerializer();
           String currentRun = serializer.serialize(mCurrentTestRun);

           Intent intent = new Intent(this, LogActivity.class);
           Bundle b = new Bundle();
           b.putString("TestResults", currentRun);
           intent.putExtras(b);
           startActivity(intent);
           return true;

	default:
		return super.onOptionsItemSelected(item);
	}
}
 
开发者ID:OfficeDev,项目名称:Microsoft-Graph-SDK-Android,代码行数:44,代码来源:MainActivity.java

示例5: getJsonSerializer

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
@Override
public JsonSerializer getJsonSerializer() {
    return new GsonSerializer();
}
 
开发者ID:OfficeDev,项目名称:orc-for-android,代码行数:5,代码来源:DefaultDependencyResolver.java

示例6: onOptionsItemSelected

import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case R.id.menu_settings:
		startActivity(new Intent(this, OfficePreferenceActivity.class));
		return true;

	case R.id.menu_run_tests:
		if (ApplicationContext.getExchangeEndpointUrl().trim().equals("")) {
			startActivity(new Intent(this, OfficePreferenceActivity.class));
		} else {
               mCurrentTestRun = new ArrayList<>();
			runTests();
		}
		return true;

	case R.id.menu_check_all:
		changeCheckAllTests(true);
		return true;

	case R.id.menu_uncheck_all:
		changeCheckAllTests(false);
		return true;

	case R.id.menu_reset:
		refreshTestGroupsAndLog();
		return true;

	case R.id.menu_view_log:
           GsonSerializer serializer = new GsonSerializer();
           String currentRun = serializer.serialize(mCurrentTestRun);

           Intent intent = new Intent(this, LogActivity.class);
           Bundle b = new Bundle();
           b.putString("TestResults", currentRun);
           intent.putExtras(b);
           startActivity(intent);
           return true;

	default:
		return super.onOptionsItemSelected(item);
	}
}
 
开发者ID:OfficeDev,项目名称:Outlook-SDK-Android,代码行数:44,代码来源:MainActivity.java


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