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


Java GsonBuilder.setFieldNamingPolicy方法代码示例

本文整理汇总了Java中com.google.gson.GsonBuilder.setFieldNamingPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java GsonBuilder.setFieldNamingPolicy方法的具体用法?Java GsonBuilder.setFieldNamingPolicy怎么用?Java GsonBuilder.setFieldNamingPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gson.GsonBuilder的用法示例。


在下文中一共展示了GsonBuilder.setFieldNamingPolicy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unpack

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public void unpack(@NonNull final JSONObject payload) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "unpacking");
    }

    final GsonBuilder builder = new GsonBuilder();
    builder.disableHtmlEscaping();
    builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);

    final Gson gson = builder.create();
    nluNuance = gson.fromJson(payload.toString(), new TypeToken<NLUNuance>() {
    }.getType());

    new NLUCoerce(getNLUNuance(), getContext(), getSupportedLanguage(), getVRLocale(), getTTSLocale(),
            getConfidenceArray(), getResultsArray()).coerce();
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:17,代码来源:ResolveNuance.java

示例2: unpack

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public void unpack(@NonNull final JSONObject payload) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "unpacking");
    }

    final GsonBuilder builder = new GsonBuilder();
    builder.disableHtmlEscaping();
    builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);

    final Gson gson = builder.create();
    nluSaiy = gson.fromJson(payload.toString(), new TypeToken<NLUSaiy>() {
    }.getType());

    new NLUCoerce(getNLUSaiy(), getContext(), getSupportedLanguage(), getVRLocale(), getTTSLocale(),
            getConfidenceArray(), getResultsArray()).coerce();
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:17,代码来源:ResolveSaiy.java

示例3: createGson

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
/**
     * Create the standard {@link Gson} configuration
     *
     * @param serializeNulls whether nulls should be serialized
     * @return created gson, never null
     */
    public static final Gson createGson(final boolean serializeNulls) {
        final GsonBuilder builder = new GsonBuilder();
//		builder.registerTypeAdapter(Date.class, new DateFormatter());
//		builder.registerTypeAdapter(Event.class, new EventFormatter());
        builder.setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES);
        if (serializeNulls)
            builder.serializeNulls();
        return builder.create();
    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:16,代码来源:GsonUtils.java

示例4: call

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public static TmdbService call() {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);

    Gson gson = gsonBuilder.create();

    OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
        @Override
        public Response intercept(Chain chain) throws IOException {
            Request request = chain.request();
            HttpUrl url = request.url().newBuilder()
                    .addQueryParameter("api_key", API_KEY)
                    .build();

            request = request.newBuilder().url(url).build();

            return chain.proceed(request);
        }
    }).build();

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(BASE_URL)
            .client(client)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build();

    return retrofit.create(TmdbService.class);
}
 
开发者ID:ramadani,项目名称:Pilem,代码行数:29,代码来源:ApiBuilder.java

示例5: provideGson

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
@Provides
@AppScope
Gson provideGson() {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
    return gsonBuilder.create();
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:8,代码来源:ApiModule.java

示例6: provideGson

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
@Provides
@Singleton
Gson provideGson() {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
    return gsonBuilder.create();
}
 
开发者ID:ragdroid,项目名称:mockstar,代码行数:8,代码来源:ApiModule.java

示例7: provideGson

import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
@Provides
@Singleton
static Gson provideGson() {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
    return gsonBuilder.create();
}
 
开发者ID:ragdroid,项目名称:Dahaka,代码行数:8,代码来源:ApiModule.java


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