• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Converters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LongRenderer类代码示例发布时间:2022-05-22
下一篇:
Java PersistentBase类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap