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


Java VavrModule.Settings方法代码示例

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


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

示例1: initMapper

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
public static void initMapper(TypeSpec.Builder builder, String name, VavrModule.Settings settings) {
    Modifier[] mods = new Modifier[] { Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL };
    if (settings != null) {
        builder.addField(FieldSpec.builder(ClassName.get(VavrModule.Settings.class), name + "_SETTINGS", mods)
                .initializer("new $T()\n        .useOptionInPlainFormat($L).deserializeNullAsEmptyCollection($L)",
                        ClassName.get(VavrModule.Settings.class),
                        settings.useOptionInPlainFormat(), settings.deserializeNullAsEmptyCollection())
                .build());
        builder.addField(FieldSpec.builder(ClassName.get(VavrModule.class), name + "_MODULE", mods)
                .initializer("new $T($L)", ClassName.get(VavrModule.class), name + "_SETTINGS")
                .build());
    } else {
        builder.addField(FieldSpec.builder(ClassName.get(VavrModule.class), name + "_MODULE", mods)
                .initializer("new $T()", ClassName.get(VavrModule.class))
                .build());
    }
    builder.addField(FieldSpec.builder(ClassName.get(ObjectMapper.class), name, mods)
            .initializer("new $T().registerModule($L)", ClassName.get(ObjectMapper.class), name + "_MODULE")
            .build());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:21,代码来源:Initializer.java

示例2: test4

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
@Test
public void test4() throws IOException {
    VavrModule.Settings settings = new VavrModule.Settings();
    settings.deserializeNullAsEmptyCollection(true);
    ObjectMapper mapper = mapper(settings);
    Set<?> restored = mapper.readValue("null", typeReference());
    Assert.assertTrue(restored.isEmpty());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:9,代码来源:SetTest.java

示例3: test4

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
@Test
public void test4() throws IOException {
    VavrModule.Settings settings = new VavrModule.Settings();
    settings.deserializeNullAsEmptyCollection(true);
    ObjectMapper mapper = mapper(settings);
    Seq<?> restored = (Seq<?>) mapper.readValue("null", clz());
    Assert.assertTrue(restored.isEmpty());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:9,代码来源:SeqTest.java

示例4: VavrSerializers

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
public VavrSerializers(VavrModule.Settings settings) {
    this.settings = settings;
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:4,代码来源:VavrSerializers.java

示例5: VavrDeserializers

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
public VavrDeserializers(VavrModule.Settings settings) {
    this.settings = settings;
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:4,代码来源:VavrDeserializers.java

示例6: VavrBundle

import io.vavr.jackson.datatype.VavrModule; //导入方法依赖的package包/类
/**
 * Add Vavr support (Jackson, Jersey) to Dropwizard.
 *
 * @param registerMessageBodyWriters Register {@link EitherMessageBodyWriter} and {@link ValueMessageBodyWriter}
 *                                   in {@link com.fasterxml.jackson.databind.ObjectMapper}.
 *                                   <em>NOTE:</em> This will make it impossible to serialize or deserialize classes
 *                                   such as {@link io.vavr.control.Either}, {@link io.vavr.control.Option}, and
 *                                   {@link io.vavr.Lazy} with Jackson. Use with care!
 */
public VavrBundle(boolean registerMessageBodyWriters) {
    this(new VavrModule.Settings(), registerMessageBodyWriters);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:13,代码来源:VavrBundle.java


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