本文整理汇总了Java中com.fatboyindustrial.gsonjodatime.Converters类的典型用法代码示例。如果您正苦于以下问题:Java Converters类的具体用法?Java Converters怎么用?Java Converters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Converters类属于com.fatboyindustrial.gsonjodatime包,在下文中一共展示了Converters类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: gson
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
private Gson gson() {
final GsonBuilder builder = new GsonBuilder();
// support swagger json
builder.registerTypeAdapter(Json.class, new SpringfoxJsonToGsonAdapter());
return Converters.registerDateTime(builder).create();
}
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:8,代码来源:WebConfig.java
示例2: configureMessageConverters
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
@Override
public boolean configureMessageConverters(List<MessageConverter> messageConverters) {
messageConverters.add(new StringMessageConverter());
messageConverters.add(new ByteArrayMessageConverter());
GsonMessageConverter gsonMessageConverter = new GsonMessageConverter();
gsonMessageConverter.setGson(Converters.registerDateTime(new GsonBuilder()).create());
messageConverters.add(gsonMessageConverter);
return false;
}
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:12,代码来源:WebSocketConfig.java
示例3: context
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
@AppScope
@Provides
public Gson context() {
return Converters.registerAll(new GsonBuilder())
.registerTypeAdapterFactory(GithubAdapterFactory.create())
.create();
}
开发者ID:patrick-doyle,项目名称:android-rxmvp-tutorial,代码行数:8,代码来源:GsonModule.java
示例4: providesGson
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
@Provides
@Singleton
Gson providesGson() {
return Converters.registerAll(new GsonBuilder())
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapterFactory(new GsonAdaptersModel())
.create();
}
开发者ID:grundleborg,项目名称:matterdroid,代码行数:9,代码来源:GsonModule.java
示例5: gson
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
@AppScope
@Provides
public Gson gson() {
GsonBuilder builder = new GsonBuilder();
Converters.registerAll(builder);
return builder.create();
}
开发者ID:patrick-doyle,项目名称:android-rxmvp,代码行数:8,代码来源:GsonModule.java
示例6: ServerService
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
public ServerService(String serviceUrl, final String userName, final String password, SharedPreferences sharedPreferences) {
final TokenManager tokenManager = new TokenManager(sharedPreferences);
// -- Initializing gson factory with joda converters and underscores default policy
GsonBuilder builder = new GsonBuilder();
builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
Converters.registerLocalDate(builder);
Converters.registerLocalTime(builder);
// -- For Token Authentication Purposes
OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.setAuthenticator(tokenManager);
RestAdapter restAdapter = new RestAdapter.Builder()
.setLogLevel(RestAdapter.LogLevel.FULL)
.setConverter(new GsonConverter(builder.create()))
.setEndpoint(serviceUrl)
.setRequestInterceptor(tokenManager)
.setClient(new OkClient(okHttpClient)).build();
this.serverApi = restAdapter.create(ServerApi.class);
// -- Call login to get a new Token only WHEN it is needed
tokenManager.setTokenAction(new TokenManager.TokenAction() {
@Override
public void newToken() {
// -- Getting Authentication Token
serverApi.login(userName, password, tokenManager);
}
});
}
开发者ID:thiagopa,项目名称:planyourexchange,代码行数:33,代码来源:ServerService.java
示例7: getUserData
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
/**
* @param context
* of the running activity
* @param identifier
* is the id used by the system to uniquely identify the user
* within the system
* @return The UserData object is returned if found else a null is
* returned
*/
public static UserData getUserData(Context context, String identifier) {
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
UserData userData = null;
SharedPreferences sp = context.getSharedPreferences("UserData",
Context.MODE_PRIVATE);
String value = sp.getString(identifier, null);
if (value != null) {
userData = gson.fromJson(value.toString(), UserData.class);
}
return userData;
}
开发者ID:cherrymathew,项目名称:evend,代码行数:24,代码来源:StorageHelper.java
示例8: setUserData
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
/**
* @param context
* of the running activity.
* @param identifer
* is the id used by the system to uniquely identify the user
* within the system.
* @param userData
* The UserData object that is going to be stored in the
* SharedPreferences.
*/
public static void setUserData(Context context, String identifer,
UserData userData) {
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
SharedPreferences sp = context.getSharedPreferences("UserData",
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
String value = gson.toJson(userData);
editor.putString(identifer, value);
editor.commit();
}
开发者ID:cherrymathew,项目名称:evend,代码行数:22,代码来源:StorageHelper.java
示例9: getUserData
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
public void getUserData(View view) {
UserData userData = new UserData("email", "[email protected]");
UserOauthData userOauthData = new UserOauthData("Provider",
"AccessToken", "[email protected]");
List<TalkData> talksList = new ArrayList<TalkData>();
for (int i = 0; i < 1; i++) {
TalkData talkData = new TalkData("Tile " + i, "2015-09-" + (i + 1));
talksList.add(talkData);
}
userData.setAuthToken("diIfbxEhdgOxL1OkG1GhWzjNnuKVrUyxF20EfVYqxbOQZfUd5uqM8pWreQOpto");
userData.setOauthData(userOauthData);
userData.setTalkDataList(talksList);
// Gson gson = new Gson();
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
String data = gson.toJson(userData);
DebugHelper.ShowMessage.d(data);
UserData restoredData;
restoredData = gson.fromJson(data.toString(), UserData.class);
DebugHelper.ShowMessage.d(restoredData.getAuthToken());
}
开发者ID:cherrymathew,项目名称:evend,代码行数:28,代码来源:MainActivity.java
示例10: get
import com.fatboyindustrial.gsonjodatime.Converters; //导入依赖的package包/类
public static Gson get() {
if (builder == null) {
builder = new GsonBuilder();
// register date and time converters
Converters.registerAll(builder);
gson = builder.create();
}
return gson;
}
开发者ID:citiususc,项目名称:calendula,代码行数:11,代码来源:GsonUtil.java
注:本文中的com.fatboyindustrial.gsonjodatime.Converters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论