本文整理汇总了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;
}
}
示例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();
}
示例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()));
}
示例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);
}
}
示例5: getJsonSerializer
import com.microsoft.services.orc.serialization.impl.GsonSerializer; //导入依赖的package包/类
@Override
public JsonSerializer getJsonSerializer() {
return new GsonSerializer();
}
示例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);
}
}